-
-
Notifications
You must be signed in to change notification settings - Fork 180
293 lines (282 loc) · 14.7 KB
/
build-release-latest-test-artifacts.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
name: build-release-latest
on:
push:
tags-ignore: 'v*'
branches:
- '**'
- '!master'
- '!*.*.*'
env:
python_win_version: 3.11.8
repo_dir: nagstamon-jekyll/docs/repo
cr_image: ghcr.io/henriwahl/build-nagstamon
# to be increased if new updates of build images are necessary
cr_image_version: 4
# release type this file is used for
release: latest
jobs:
debian:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# docker login is needed for pushing the build image
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# if image defined by variable cr_image_version is not pullable aka does not exist it will be created and pushed
- run: docker pull ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }} || /usr/bin/docker build -t ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }} -f build/docker/Dockerfile-${{ github.job }} .
- run: docker push ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }}
# building in precompiled image makes them way faster instead of creating the build environment every time from scratch
- run: /usr/bin/docker run -v ${{ github.workspace }}:/nagstamon -e DEB_BUILD_OPTIONS=nocheck ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }}
- uses: actions/upload-artifact@v4
with:
path: build/*.deb
retention-days: 1
if-no-files-found: error
name: ${{ github.job }}
fedora-37:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# docker login is needed for pushing the build image
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# if image defined by variable cr_image_version is not pullable aka does not exist it will be created and pushed
- run: docker pull ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }} || /usr/bin/docker build -t ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }} -f build/docker/Dockerfile-${{ github.job }} .
- run: docker push ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }}
# building in precompiled image makes them way faster instead of creating the build environment every time from scratch
- run: /usr/bin/docker run -v ${{ github.workspace }}:/nagstamon ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }}
- uses: actions/upload-artifact@v4
with:
path: build/*.rpm
retention-days: 1
if-no-files-found: error
name: ${{ github.job }}
fedora-38:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# docker login is needed for pushing the build image
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# if image defined by variable cr_image_version is not pullable aka does not exist it will be created and pushed
- run: docker pull ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }} || /usr/bin/docker build -t ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }} -f build/docker/Dockerfile-${{ github.job }} .
- run: docker push ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }}
# building in precompiled image makes them way faster instead of creating the build environment every time from scratch
- run: /usr/bin/docker run -v ${{ github.workspace }}:/nagstamon ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }}
- uses: actions/upload-artifact@v4
with:
path: build/*.rpm
retention-days: 1
if-no-files-found: error
name: ${{ github.job }}
fedora-39:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# docker login is needed for pushing the build image
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# if image defined by variable cr_image_version is not pullable aka does not exist it will be created and pushed
- run: docker pull ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }} || /usr/bin/docker build -t ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }} -f build/docker/Dockerfile-${{ github.job }} .
- run: docker push ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }}
# building in precompiled image makes them way faster instead of creating the build environment every time from scratch
- run: /usr/bin/docker run -v ${{ github.workspace }}:/nagstamon ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }}
- uses: actions/upload-artifact@v4
with:
path: build/*.rpm
retention-days: 1
if-no-files-found: error
name: ${{ github.job }}
fedora-40:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# docker login is needed for pushing the build image
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# if image defined by variable cr_image_version is not pullable aka does not exist it will be created and pushed
- run: docker pull ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }} || /usr/bin/docker build -t ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }} -f build/docker/Dockerfile-${{ github.job }} .
- run: docker push ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }}
# building in precompiled image makes them way faster instead of creating the build environment every time from scratch
- run: /usr/bin/docker run -v ${{ github.workspace }}:/nagstamon ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }}
- uses: actions/upload-artifact@v4
with:
path: build/*.rpm
retention-days: 1
if-no-files-found: error
name: ${{ github.job }}
fedora-41:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# docker login is needed for pushing the build image
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# if image defined by variable cr_image_version is not pullable aka does not exist it will be created and pushed
- run: docker pull ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }} || /usr/bin/docker build -t ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }} -f build/docker/Dockerfile-${{ github.job }} .
- run: docker push ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }}
# building in precompiled image makes them way faster instead of creating the build environment every time from scratch
- run: /usr/bin/docker run -v ${{ github.workspace }}:/nagstamon ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }}
- uses: actions/upload-artifact@v4
with:
path: build/*.rpm
retention-days: 1
if-no-files-found: error
name: ${{ github.job }}
rhel-9:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# docker login is needed for pushing the build image
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# if image defined by variable cr_image_version is not pullable aka does not exist it will be created and pushed
- run: docker pull ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }} || /usr/bin/docker build -t ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }} -f build/docker/Dockerfile-${{ github.job }} .
- run: docker push ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }}
# building in precompiled image makes them way faster instead of creating the build environment every time from scratch
- run: /usr/bin/docker run -v ${{ github.workspace }}:/nagstamon ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }}
- uses: actions/upload-artifact@v4
with:
path: build/*.rpm
retention-days: 1
if-no-files-found: error
name: ${{ github.job }}
# borrowed from dhcpy6d
repo-debian:
runs-on: ubuntu-latest
# try to avoid race condition and start uploading only after the last install package has been build
needs: [debian, fedora-37, fedora-38, fedora-39, fedora-40, fedora-41, rhel-9]
env:
family: debian
steps:
- uses: actions/checkout@v4
# get binaries created by other jobs
- uses: actions/download-artifact@v4
with:
pattern: 'debian*'
path: artifact
merge-multiple: true
- run: pwd
- run: find . -name '*.deb'
# get secret signing key
- run: echo "${{ secrets.PACKAGE_SIGNING_KEY }}" > signing_key.asc
# organize SSH deploy key for nagstamon-jekyll repo
- run: mkdir ~/.ssh
- run: echo "${{ secrets.NAGSTAMON_REPO_KEY_WEB }}" > ~/.ssh/id_ed25519
- run: chmod -R go-rwx ~/.ssh
# get and prepare nagstamon-jekyll
- run: git clone [email protected]:HenriWahl/nagstamon-jekyll.git
- run: rm -rf ${{ env.repo_dir }}/${{ env.family }}/${{ env.dist }}/${{ env.release }}
- run: mkdir -p ${{ env.repo_dir }}/${{ env.family }}/${{ env.dist }}/${{ env.release }}
# create deb repo via Debian build container
- run: |
/usr/bin/docker run --rm \
-v ${{ github.workspace }}:/workspace \
-v $PWD/${{ env.repo_dir }}/${{ env.family }}/${{ env.release }}:/repo \
${{ env.cr_image }}-${{ env.family }}:${{ env.cr_image_version }} \
/bin/sh -c "cd /workspace && \
gpg --import signing_key.asc && \
cp -r artifact/*.deb nagstamon-jekyll/docs/repo/${{ env.family }}/${{ env.release }} && \
cd nagstamon-jekyll/docs/repo/${{ env.family }}/${{ env.release }}
dpkg-scanpackages . > Packages && \
gzip -k -f Packages && \
apt-ftparchive release . > Release && \
gpg -abs -o Release.gpg Release && \
gpg --clearsign -o InRelease Release && \
gpg --output key.gpg --armor --export"
# commit and push new binaries to nagstamon-jekyll
- run: git config --global user.email "[email protected]" && git config --global user.name "Nagstamon Repository"
- run: cd ${{ env.repo_dir }} && git add . && git commit -am "new ${{ env.release }} repo ${{ env.family }}" && git push
repo-rpm-fedora:
runs-on: ubuntu-latest
# if not all are ready there might be trouble when downloading artifacts
# maybe faster now with build containers
needs: [repo-debian]
env:
family: fedora
# which image to use for packaging
cr_image_latest: 39
steps:
# get binaries created by other jobs
- uses: actions/download-artifact@v4
with:
pattern: 'fedora*'
path: artifact
merge-multiple: true
# organize SSH deploy key for nagstamon-repo
- run: mkdir ~/.ssh
- run: echo "${{ secrets.NAGSTAMON_REPO_KEY_WEB }}" > ~/.ssh/id_ed25519
- run: chmod -R go-rwx ~/.ssh
# get and prepare nagstamon-jekyll
- run: git clone [email protected]:HenriWahl/nagstamon-jekyll.git
- run: rm -rf ${{ env.repo_dir }}/${{ env.family }}/${{ env.release }}
- run: mkdir -p ${{ env.repo_dir }}/${{ env.family }}/${{ env.release }}
# copy *.rpm files into nagstamon-jekyll and create repodata
- run: |
version=${{ env.release }} && \
mkdir -p mkdir -p ${{ env.repo_dir }}/${{ env.family }}/${version} && \
cp -r artifact/*.${{ env.family }}* ${{ env.repo_dir }}/${{ env.family }}/${version} && \
docker run --rm -v ${PWD}/${{ env.repo_dir }}/${{ env.family }}/${version}:/repo \
${{ env.cr_image }}-${{ env.family }}-${{ env.cr_image_latest }}:${{ env.cr_image_version }} \
/bin/bash -c "createrepo --verbose --workers 1 /repo" && \
ls -laR ${PWD}/${{ env.repo_dir }}/${{ env.family }}/${version}
# commit and push new binaries to nagstamon-repo
- run: git config --global user.email "[email protected]" && git config --global user.name "Nagstamon Repository"
- run: cd ${{ env.repo_dir }} && git pull && git add . && git commit -am "new latest repo ${{ env.family }}" && git push
repo-rpm-rhel:
runs-on: ubuntu-latest
# if not all are ready there might be trouble when downloading artifacts
# maybe faster now with build containers
needs: [repo-rpm-fedora]
env:
family: rhel
# currently just one version available
version: 9
steps:
# get binaries created by other jobs
- uses: actions/download-artifact@v4
with:
name: 'rhel*'
path: artifact
merge-multiple: true
# organize SSH deploy key for nagstamon-repo
- run: mkdir ~/.ssh
- run: echo "${{ secrets.NAGSTAMON_REPO_KEY_WEB }}" > ~/.ssh/id_ed25519
- run: chmod -R go-rwx ~/.ssh
# get and prepare nagstamon-jekyll
- run: git clone [email protected]:HenriWahl/nagstamon-jekyll.git
- run: rm -rf ${{ env.repo_dir }}/${{ env.family }}/${{ env.release }}
- run: mkdir -p ${{ env.repo_dir }}/${{ env.family }}/${{ env.release }}
# copy *.rpm files into nagstamon-jekyll and create repodata
- run: |
version=${{ env.release }} && \
mkdir -p mkdir -p ${{ env.repo_dir }}/${{ env.family }}/${version} && \
cp -r artifact/*.${{ env.family }}* ${{ env.repo_dir }}/${{ env.family }}/${version} && \
docker run --rm -v ${PWD}/${{ env.repo_dir }}/${{ env.family }}/${version}:/repo \
${{ env.cr_image }}-${{ env.family }}-${{ env.version }}:${{ env.cr_image_version }} \
/bin/bash -c "createrepo --verbose --workers 1 /repo" && \
ls -laR ${PWD}/${{ env.repo_dir }}/${{ env.family }}/${version}
# commit and push new binaries to nagstamon-repo
- run: git config --global user.email "[email protected]" && git config --global user.name "Nagstamon Repository"
- run: cd ${{ env.repo_dir }} && git pull && git add . && git commit -am "new latest repo ${{ env.family }}" && git push