-
Notifications
You must be signed in to change notification settings - Fork 1
259 lines (229 loc) · 8.2 KB
/
Copy pathdeploy-backup.yml
File metadata and controls
259 lines (229 loc) · 8.2 KB
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
name: Build documentation
on:
# If specified, the workflow will be triggered automatically once you push to the `main` branch.
# Replace `main` with your branch’s name
# push:
# branches: [ "main" ]
# Specify to run a workflow manually from the Actions tab on GitHub
workflow_dispatch:
# Gives the workflow permissions to clone the repo and create a page deployment
permissions:
id-token: write
pages: write
env:
# Name of module and id separated by a slash
INSTANCE: Writerside2/auto
# Replace HI with the ID of the instance in capital letters
ARTIFACT: webHelpAUTO2-all.zip
# Writerside docker image version
DOCKER_VERSION: '243.21565'
# Add the variable below to upload Algolia indexes
# Replace HI with the ID of the instance in capital letters
ALGOLIA_ARTIFACT: 'algolia-indexes-AUTO.zip'
ALGOLIA_APP_NAME: 'ERUSDW4898'
ALGOLIA_INDEX_NAME: 'index_test'
CONFIG_JSON_PRODUCT: 'AUTO'
CONFIG_JSON_VERSION: '1.0'
PDF: 'PDF.xml'
jobs:
build-site1:
runs-on: ubuntu-latest
container: jetbrains/writerside-builder:243.21565
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Processing timestamps
run: |
git config --global --add safe.directory /__w/siarb.github.io/siarb.github.io
mkdir -p ./timestamps
echo "{" > ./timestamps/timestamps.json
git ls-tree -r --name-only HEAD | grep -E '\.(topic|md)$' | xargs -n 1 -P 4 -I{} bash -c 'echo -e "\"$0\": \"$(git log -1 --format="%at" -- "$0")\","' {} >> ./timestamps/timestamps.json
sed -i '$ s/.$//' ./timestamps/timestamps.json
echo "}" >> ./timestamps/timestamps.json
cat ./timestamps/timestamps.json
- name: Store timestamps file
uses: actions/upload-artifact@v4
with:
name: timestamps.json
path: ./timestamps/timestamps.json
- name: Download timestamps
uses: actions/download-artifact@v4
with:
name: timestamps.json
path: timestamps
- name: Build Writerside docs using Docker
run: |
set -x
echo "Build documentation script started"
export DISPLAY=:99
Xvfb :99 &
git config --global --add safe.directory .
/opt/builder/bin/idea.sh helpbuilderinspect -source-dir . -product ${{ env.INSTANCE }} --runner github -output-dir ./artifacts -pdf PDF.xml
echo "Test existing artifacts"
test -e ./artifacts/${{ env.ARTIFACT }} && echo ${{ env.ARTIFACT }} exists
test -e ./artifacts/pdfSourceAUTO.pdf && echo pdfSourceAUTO.pdf exists
- name: List artifacts directory
run: |
ls -alR ./artifacts
- name: Save artifact with build results
uses: actions/upload-artifact@v4
with:
name: docs
path: |
# artifacts/${{ env.ARTIFACT }}
# artifacts/report.json
# artifacts/report.html
# artifacts/${{ env.ALGOLIA_ARTIFACT }}
# artifacts/xliffSrcAUTO.zip
# artifacts/pdfSourceAUTO.pdf
artifacts/pdfSourceAUTO.pdf
artifacts/pdfSourceAUTO.html
retention-days: 7
#
# build-site1:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout repository for site2
# uses: actions/checkout@v4
# with:
# fetch-depth: 0
#
# - name: Define instance id
# run: |
# INSTANCE_ID="${INSTANCE#*/}"
# INSTANCE_ID_UPPER=$(echo "$INSTANCE_ID" | tr '[:lower:]' '[:upper:]')
# echo "INSTANCE_ID_UPPER=$INSTANCE_ID_UPPER" >> $GITHUB_ENV
# echo "Extracted ID: $INSTANCE_ID_UPPER"
#
# - name: Build Writerside docs using Docker
# uses: JetBrains/writerside-github-action@v4
# with:
# instance: ${{ env.INSTANCE }}
# artifact: ${{ env.ARTIFACT }}
# docker-version: ${{ env.DOCKER_VERSION }}
# pdf: ${{ env.PDF }}
#
# - name: Save Not-Yet artifact
# uses: actions/upload-artifact@v4
# with:
# name: docs-site1
# path: |
# # artifacts/${{ env.ARTIFACT }}
# # artifacts/report.json
# # artifacts/${{ env.ALGOLIA_ARTIFACT }}
# artifacts/pdfSource${{ env.INSTANCE_ID_UPPER }}.pdf
# artifacts/pdfSource${{ env.INSTANCE_ID_UPPER }}.html
# retention-days: 7
# Add the job below and artifacts/report.json on Upload documentation step above if you want to fail the build when documentation contains errors
test:
# Requires build job results
needs: build-site1
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: docs-site1
path: artifacts
- name: Test documentation
uses: JetBrains/writerside-checker-action@v1
with:
instance: ${{ env.INSTANCE }}
build-site2:
runs-on: ubuntu-latest
steps:
- name: Checkout repository for site2
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build Not-Yet using Writerside Docker builder
uses: JetBrains/writerside-github-action@v4
with:
instance: 'Writerside2/t'
artifact: 'webHelpT2-all.zip'
docker-version: ${{ env.DOCKER_VERSION }}
- name: List artifacts directory
run: |
ls -alR ./artifacts
- name: Save Not-Yet artifact
uses: actions/upload-artifact@v4
with:
name: docs-site2
path: |
artifacts/webHelpT2-all.zip
artifacts/report.json
retention-days: 7
test-site2:
needs: build-site2
runs-on: ubuntu-latest
steps:
- name: Download Not-Yet artifacts
uses: actions/download-artifact@v4
with:
name: docs-site2
path: artifacts
- name: Test Not-Yet documentation
uses: JetBrains/writerside-checker-action@v1
with:
instance: 'Writerside2/t'
publish-indexes:
# Requires the build-job results
needs: build-site1
runs-on: ubuntu-latest
container:
image: registry.jetbrains.team/p/writerside/builder/algolia-publisher:2.0.32-3
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: docs-site1
- name: Unzip artifact
run: |
if [ -z "${{ secrets.ALGOLIA_KEY }}" ]; then
echo "ALGOLIA_KEY secret is not set in GitHub Secrets"
exit 1
else
unzip -O UTF-8 -qq ${{ env.ALGOLIA_ARTIFACT }} -d algolia-indexes
env "algolia-key=${{ secrets.ALGOLIA_KEY }}" java -jar /opt/builder/help-publication-agent.jar \
update-index \
--application-name ${{env.ALGOLIA_APP_NAME}} \
--index-name ${{env.ALGOLIA_INDEX_NAME}} \
--product ${{env.CONFIG_JSON_PRODUCT}} \
--version ${{env.CONFIG_JSON_VERSION}} \
--index-directory algolia-indexes
fi
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
# Requires the build job results
needs: build-site1
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: docs-site1
- name: Download Not-Yet artifacts
uses: actions/download-artifact@v4
with:
name: docs-site2
- name: Unzip artifact
run: |
mkdir -p dir/site1
unzip -O UTF-8 -qq ${{ env.ARTIFACT }} -d dir/site1
- name: Unzip Not-Yet artifact
run: |
mkdir -p dir/site2
unzip -O UTF-8 -qq 'webHelpT2-all.zip' -d dir/site2
- name: Setup Pages
uses: actions/configure-pages@v4.0.0
- name: Upload artifact
uses: actions/upload-pages-artifact@v3.0.1
with:
path: dir
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4