forked from kanidm/kanidm
-
Notifications
You must be signed in to change notification settings - Fork 0
139 lines (132 loc) · 3.76 KB
/
kanidm_book.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
---
name: GitHub Pages
"on":
push:
branches:
- "master"
pull_request:
# yamllint disable-line rule:line-length
# permissions list: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token
permissions:
id-token: write
actions: read
checks: read
contents: write
deployments: write
issues: read
pull-requests: read
statuses: read
pages: write
env:
ACTIONS_RUNNER_DEBUG: true
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
pre_deploy:
runs-on: ubuntu-latest
outputs:
latest: ${{ steps.branchname.outputs.latest }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Latest branch
run: |
echo "latest=$(git branch -a \
| awk '{print $1}' \
| sort -t. -k3n,3 -k4n,4 \
| awk -F'/' '{print $NF}' \
| grep -E '^[[:digit:]]\.[[:digit:]]\.[[:digit:]]' \
| sort -t. \
| tail -n1)" >> $GITHUB_OUTPUT
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@v4
with:
name: base
path: docs/index.html
fanout:
uses: './.github/workflows/kanidm_individual_book.yml'
needs: pre_deploy
# yamllint disable-line rule:line-length
strategy:
fail-fast: false
matrix:
tag:
- ${{ needs.pre_deploy.outputs.latest}}
with:
tag: ${{ matrix.tag }}
parent_id: ${{ github.ref }}
docs_master:
uses: './.github/workflows/kanidm_individual_book.yml'
with:
tag: "master"
parent_id: ${{ github.ref }}
deploy:
environment:
name: "github-pages"
url: ${{ steps.deployment.outputs.page_url }}
needs:
- pre_deploy
- fanout
- docs_master
runs-on: ubuntu-latest
# yamllint disable-line rule:line-length
if: ${{ github.ref == 'refs/heads/master' && github.repository == 'kanidm/kanidm' }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download base artifact
uses: actions/download-artifact@v4
with:
name: base
path: ./docs/
env:
ACTIONS_RUNNER_DEBUG: true
- name: Download master artifact
uses: actions/download-artifact@v4
with:
name: individualmaster
path: ./docs/
env:
ACTIONS_RUNNER_DEBUG: true
- name: Download stable artifact
uses: actions/download-artifact@v4
with:
name: "individual${{ needs.pre_deploy.outputs.latest }}"
path: ./docs/
env:
ACTIONS_RUNNER_DEBUG: true
- name: Extract the files
run: |
pwd
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
cd docs && cp -R "${{ needs.pre_deploy.outputs.latest}}" stable && cd ..
ls -la docs/
echo "Cleaning up docs archives"
rm docs/*.tar.gz
env:
ACTIONS_RUNNER_DEBUG: true
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload pages artifacts
uses: actions/upload-pages-artifact@v3
with:
# Upload entire repository
path: 'docs/'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4