-
Notifications
You must be signed in to change notification settings - Fork 1
334 lines (302 loc) · 12 KB
/
lernos-produktionskette.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
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
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
name: lernOS Produktionskette
on:
pull_request:
branches:
- main
workflow_dispatch:
jobs:
convert_via_pandoc:
runs-on: ubuntu-latest
steps:
# Checkout the repository (pull request's code)
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history
# Install yq from binary release
- name: Install yq
run: |
sudo wget https://github.com/mikefarah/yq/releases/download/v4.30.6/yq_linux_amd64 -O /usr/bin/yq
sudo chmod +x /usr/bin/yq
# Read the date from metadata.yaml de
- name: Read date from metadata.yaml de
id: read_date
run: |
DATE=$(yq '.date' de/metadata.yaml)
echo "date=$DATE" >> $GITHUB_OUTPUT
# Read the date from metadata.yaml en
- name: Read date from metadata.yaml en
id: read_date_en
run: |
DATEEN=$(yq '.date' en/metadata.yaml)
echo "dateen=$DATEEN" >> $GITHUB_OUTPUT
# Update date in mkdocs.yml de
- name: Update date in mkdocs.yml de
run: |
DATE=${{ steps.read_date.outputs.date }}
sed -i "s/releases\/download\/[0-9]\+\.[0-9]\+\.[0-9]\+/releases\/download\/$DATE/g" de/mkdocs.yml
# Update date in mkdocs.yml en
- name: Update date in mkdocs.yml en
run: |
DATEEN=${{ steps.read_date_en.outputs.dateen }}
sed -i "s/releases\/download\/[0-9]\+\.[0-9]\+\.[0-9]\+/releases\/download\/$DATEEN/g" en/mkdocs.yml
# Commit the updated mkdocs.yml
- name: Commit changes
run: |
git config --local user.name "GitHub Actions"
git config --local user.email "actions@github.com"
# Check if there are any changes to commit
if [ -n "$(git status --porcelain)" ]; then
git add de/mkdocs.yml en/mkdocs.yml
git commit -m "Update download links to version ${{ steps.read_date.outputs.date }}"
git push origin HEAD:${{ github.head_ref }}
else
echo "No changes to commit."
fi
# Create Chapter List de
- name: Create Chapter List de
id: chapter_list_de
run: echo "chapters=$(printf '%s ' ./de/src/*.md)" >> "$GITHUB_OUTPUT"
# Create Microsoft Word Version (docx) de
- uses: docker://pandoc/core
with:
args: >-
./de/metadata.yaml
--standalone
--resource-path=./de/src
--number-sections
--toc
-V lang=de-de
--output=./de/${{ github.event.repository.name }}-guide.docx
./de/src/index.md ${{ steps.chapter_list_de.outputs.chapters }}
# Create HTML Version (html) de
- uses: docker://pandoc/core
with:
args: >-
./de/metadata.yaml
--standalone
--resource-path=./de/src
--number-sections
--toc
-V lang=de-de
--output=./de/${{ github.event.repository.name }}-guide.html
./de/src/index.md ${{ steps.chapter_list_de.outputs.chapters }}
# Create eBook Version (epub) de
- uses: docker://pandoc/core
with:
args: >-
./de/metadata.yaml
--standalone
--resource-path=./de/src
--number-sections
--toc
-V lang=de-de
--output=./de/${{ github.event.repository.name }}-guide.epub
./de/src/index.md ${{ steps.chapter_list_de.outputs.chapters }}
# Create PDF Version (pdf) de
- uses: docker://pandoc/extra:3.1
with:
args: >-
./de/metadata.yaml
--standalone
--resource-path=./de/src
--number-sections
--toc
--toc-depth=2
-V lang=de-de
--template /.pandoc/templates/eisvogel.latex
--output=./de/${{ github.event.repository.name }}-guide.pdf
./de/src/index.md ${{ steps.chapter_list_de.outputs.chapters }}
# Create Web Version (mkdocs) de
- uses: actions/setup-python@v4
with:
python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v3
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: pip install mkdocs-material
- run: mkdocs build -f ./de/mkdocs.yml
# Execute Copy and Archive Script de
- name: build vault de
run: bash ./de/build_vault.sh
# Create Microsoft Word Version (docx) en
- uses: docker://pandoc/core
with:
args: >-
./en/metadata.yaml
--standalone
--resource-path=./en/src
--number-sections
--toc
-V lang=en-en
--output=./en/${{ github.event.repository.name }}-guide.docx
./en/src/index.md ${{ steps.chapter_list_de.outputs.chapters }}
# Create HTML Version (html) en
- uses: docker://pandoc/core
with:
args: >-
./en/metadata.yaml
--standalone
--resource-path=./de/src
--number-sections
--toc
-V lang=en-en
--output=./en/${{ github.event.repository.name }}-guide.html
./en/src/index.md ${{ steps.chapter_list_de.outputs.chapters }}
# Create eBook Version (epub) en
- uses: docker://pandoc/core
with:
args: >-
./en/metadata.yaml
--standalone
--resource-path=./en/src
--number-sections
--toc
-V lang=en-en
--output=./en/${{ github.event.repository.name }}-guide.epub
./en/src/index.md ${{ steps.chapter_list_de.outputs.chapters }}
# Create PDF Version (pdf) en
- uses: docker://pandoc/extra:3.1
with:
args: >-
./en/metadata.yaml
--standalone
--resource-path=./en/src
--number-sections
--toc
--toc-depth=2
-V lang=en-en
--template /.pandoc/templates/eisvogel.latex
--output=./en/${{ github.event.repository.name }}-guide.pdf
./en/src/index.md ${{ steps.chapter_list_de.outputs.chapters }}
# Create Web Version (mkdocs) en
- uses: actions/setup-python@v4
with:
python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v3
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: pip install mkdocs-material
- run: mkdocs build -f ./en/mkdocs.yml
# Execute Copy and Archive Script en
- name: build vault en
run: bash ./en/build_vault.sh
# Create a draft release using the version as the name
- name: Create Draft Release
id: create_release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.read_date.outputs.date }}
name: "Release ${{ steps.read_date.outputs.date }}"
draft: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Upload Release Assets - de
## Upload Release Assets .docx - de
- name: Upload Release Assets - de (docx)
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./de/${{ github.event.repository.name }}-guide.docx
asset_name: ${{ github.event.repository.name }}-guide-de.docx
asset_content_type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
## Upload Release Assets .html - de
- name: Upload Release Assets - de (html)
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./de/${{ github.event.repository.name }}-guide.html
asset_name: ${{ github.event.repository.name }}-guide-de.html
asset_content_type: text/html
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
## Upload Release Assets .epub - de
- name: Upload Release Assets - de (epub)
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./de/${{ github.event.repository.name }}-guide.epub
asset_name: ${{ github.event.repository.name }}-guide-de.epub
asset_content_type: application/epub+zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
## Upload Release Assets .pdf - de
- name: Upload Release Assets - de (pdf)
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./de/${{ github.event.repository.name }}-guide.pdf
asset_name: ${{ github.event.repository.name }}-guide-de.pdf
asset_content_type: application/pdf
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
## Upload Release Assets .zip - de
- name: Upload Release Assets - de (ZIP)
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./de/${{ github.event.repository.name }}-guide-de-vault.zip
asset_name: ${{ github.event.repository.name }}-guide-de-vault.zip
asset_content_type: application/zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Upload Release Assets - en
## Upload Release Assets .docx - en
- name: Upload Release Assets - en (docx)
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./en/${{ github.event.repository.name }}-guide.docx
asset_name: ${{ github.event.repository.name }}-guide-en.docx
asset_content_type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
## Upload Release Assets .html - en
- name: Upload Release Assets - en (html)
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./en/${{ github.event.repository.name }}-guide.html
asset_name: ${{ github.event.repository.name }}-guide-en.html
asset_content_type: text/html
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
## Upload Release Assets .epub - en
- name: Upload Release Assets - en (epub)
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./en/${{ github.event.repository.name }}-guide.epub
asset_name: ${{ github.event.repository.name }}-guide-en.epub
asset_content_type: application/epub+zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
## Upload Release Assets .pdf - en
- name: Upload Release Assets - en (pdf)
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./en/${{ github.event.repository.name }}-guide.pdf
asset_name: ${{ github.event.repository.name }}-guide-en.pdf
asset_content_type: application/pdf
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
## Upload Release Assets .zip - en
- name: Upload Release Assets - en (ZIP)
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./en/${{ github.event.repository.name }}-guide-en-vault.zip
asset_name: ${{ github.event.repository.name }}-guide-en-vault.zip
asset_content_type: application/zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}