2022-09-08 08:40:58 +02:00
|
|
|
---
|
2021-07-24 03:12:35 +02:00
|
|
|
name: GitHub Pages
|
|
|
|
|
2022-04-28 05:45:48 +02:00
|
|
|
"on":
|
2021-07-24 03:12:35 +02:00
|
|
|
push:
|
2023-05-05 13:08:54 +02:00
|
|
|
branches:
|
|
|
|
- "master"
|
|
|
|
pull_request:
|
2021-07-24 03:12:35 +02:00
|
|
|
|
2023-07-10 08:49:09 +02:00
|
|
|
# yamllint disable-line rule:line-length
|
2023-05-07 12:52:13 +02:00
|
|
|
# permissions list: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token
|
2023-05-07 11:42:16 +02:00
|
|
|
permissions:
|
|
|
|
id-token: write
|
|
|
|
actions: read
|
|
|
|
checks: read
|
|
|
|
contents: write
|
|
|
|
deployments: write
|
|
|
|
issues: read
|
|
|
|
pull-requests: read
|
|
|
|
statuses: read
|
2023-05-07 12:52:13 +02:00
|
|
|
pages: write
|
2023-05-07 11:42:16 +02:00
|
|
|
|
2023-06-28 02:34:17 +02:00
|
|
|
env:
|
|
|
|
ACTIONS_RUNNER_DEBUG: true
|
|
|
|
|
2022-11-13 23:57:05 +01:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
cancel-in-progress: true
|
2021-07-24 03:12:35 +02:00
|
|
|
jobs:
|
2023-06-28 02:34:17 +02:00
|
|
|
pre_deploy:
|
2021-07-24 03:12:35 +02:00
|
|
|
runs-on: ubuntu-latest
|
2023-04-18 13:35:40 +02:00
|
|
|
outputs:
|
2023-06-28 02:34:17 +02:00
|
|
|
latest: ${{ steps.branchname.outputs.latest }}
|
2021-07-24 03:12:35 +02:00
|
|
|
steps:
|
2023-09-06 02:25:30 +02:00
|
|
|
- uses: actions/checkout@v4
|
2022-04-28 05:45:48 +02:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2023-06-28 02:34:17 +02:00
|
|
|
- name: Latest branch
|
|
|
|
run: |
|
2023-07-10 08:49:09 +02:00
|
|
|
echo "latest=$(git branch -a \
|
|
|
|
| awk '{print $1}' \
|
|
|
|
| sort -t. -k3n,3 -k4n,4 \
|
|
|
|
| awk -F'/' '{print $NF}' \
|
|
|
|
| tail -n1)" >> $GITHUB_OUTPUT
|
2023-06-28 02:34:17 +02:00
|
|
|
id: branchname
|
|
|
|
- name: Move redirector page
|
|
|
|
run: |
|
|
|
|
mkdir docs
|
|
|
|
cp book/index_redirect.html ./docs/index.html
|
|
|
|
find ./docs > docs/manifest.txt
|
|
|
|
- name: Upload redirector artifact
|
|
|
|
# https://github.com/actions/upload-artifact
|
|
|
|
uses: actions/upload-artifact@v3
|
2022-12-26 23:52:03 +01:00
|
|
|
with:
|
2023-06-28 02:34:17 +02:00
|
|
|
name: base
|
|
|
|
path: docs/index.html
|
|
|
|
|
2023-04-18 13:35:40 +02:00
|
|
|
fanout:
|
|
|
|
uses: './.github/workflows/kanidm_individual_book.yml'
|
2023-06-28 02:34:17 +02:00
|
|
|
needs: pre_deploy
|
2023-07-10 08:49:09 +02:00
|
|
|
# yamllint disable-line rule:line-length
|
2023-04-18 13:35:40 +02:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
tag:
|
2023-06-28 02:34:17 +02:00
|
|
|
- ${{ needs.pre_deploy.outputs.latest}}
|
2023-04-18 13:35:40 +02:00
|
|
|
with:
|
|
|
|
tag: ${{ matrix.tag }}
|
|
|
|
parent_id: ${{ github.ref }}
|
|
|
|
docs_master:
|
|
|
|
uses: './.github/workflows/kanidm_individual_book.yml'
|
|
|
|
with:
|
|
|
|
tag: "master"
|
|
|
|
parent_id: ${{ github.ref }}
|
2022-12-26 23:52:03 +01:00
|
|
|
|
2023-04-18 13:35:40 +02:00
|
|
|
deploy:
|
2023-05-07 04:44:30 +02:00
|
|
|
environment:
|
2023-06-28 11:41:24 +02:00
|
|
|
name: "github-pages"
|
2023-05-07 04:44:30 +02:00
|
|
|
url: ${{ steps.deployment.outputs.page_url }}
|
2023-04-18 13:35:40 +02:00
|
|
|
needs:
|
2023-06-28 02:34:17 +02:00
|
|
|
- pre_deploy
|
2023-04-18 13:35:40 +02:00
|
|
|
- fanout
|
|
|
|
- docs_master
|
|
|
|
runs-on: ubuntu-latest
|
2023-07-10 08:49:09 +02:00
|
|
|
# yamllint disable-line rule:line-length
|
2023-08-03 06:38:28 +02:00
|
|
|
if: ${{ github.ref == 'refs/heads/master' && github.repository == 'kanidm/kanidm' }}
|
2023-04-18 13:35:40 +02:00
|
|
|
steps:
|
2023-06-28 02:34:17 +02:00
|
|
|
- name: Setup Pages
|
|
|
|
uses: actions/configure-pages@v3
|
2023-09-06 02:25:30 +02:00
|
|
|
- uses: actions/checkout@v4
|
2023-06-05 14:06:24 +02:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2023-06-28 02:34:17 +02:00
|
|
|
- name: Download base artifact
|
|
|
|
uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: base
|
|
|
|
path: ./docs/
|
|
|
|
env:
|
|
|
|
ACTIONS_RUNNER_DEBUG: true
|
|
|
|
- name: Download individual artifact
|
|
|
|
uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: individual
|
|
|
|
path: ./docs/
|
|
|
|
env:
|
|
|
|
ACTIONS_RUNNER_DEBUG: true
|
2023-04-18 13:35:40 +02:00
|
|
|
- name: Extract the files
|
2023-04-25 14:36:17 +02:00
|
|
|
run: |
|
2023-06-28 02:34:17 +02:00
|
|
|
pwd
|
|
|
|
echo "doing find $(pwd) -ls maxdepth 2"
|
|
|
|
find $(pwd) -ls -maxdepth 2
|
|
|
|
echo "doing find tar.gz ls"
|
|
|
|
find $(pwd) -name '*.tar.gz' -ls
|
|
|
|
echo "extracting"
|
|
|
|
find $(pwd) -name '*.tar.gz' -ls -exec tar zxvf "{}" \;
|
|
|
|
echo "Carrying on..."
|
|
|
|
mkdir -p docs
|
2023-07-10 08:49:09 +02:00
|
|
|
cd docs && cp -R "$(git branch -a \
|
|
|
|
| awk '{print $1}' \
|
|
|
|
| sort -t. -k3n,3 -k4n,4 \
|
|
|
|
| awk -F'/' '{print $NF}' | tail -n1)/" stable && cd ..
|
2023-04-18 13:35:40 +02:00
|
|
|
ls -la docs/
|
2023-06-28 02:34:17 +02:00
|
|
|
echo "Cleaning up docs archives"
|
|
|
|
rm docs/*.tar.gz
|
|
|
|
env:
|
|
|
|
ACTIONS_RUNNER_DEBUG: true
|
|
|
|
- name: Upload pages artifacts
|
2023-07-16 22:38:24 +02:00
|
|
|
uses: actions/upload-pages-artifact@v2
|
2023-05-05 13:08:54 +02:00
|
|
|
with:
|
2023-05-07 04:44:30 +02:00
|
|
|
# Upload entire repository
|
|
|
|
path: 'docs/'
|
|
|
|
- name: Deploy to GitHub Pages
|
|
|
|
id: deployment
|
|
|
|
uses: actions/deploy-pages@v2
|