-
Notifications
You must be signed in to change notification settings - Fork 2
210 lines (185 loc) · 7 KB
/
build-opencast-release.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
name: Build Opencast RPMs
env:
arch: noarch
repo: release
on:
workflow_dispatch:
push:
branches:
- 'r/*'
paths:
- .trigger
- oc.version
- .github/workflows/build-opencast-release.yml
- rpmbuild/SOURCES/*
- rpmbuild/SPECS/opencast.spec
jobs:
build:
strategy:
matrix:
osversion:
- 8
- 9
outputs:
oc-version: ${{ steps.version.outputs.version }}
arch: ${{ env.arch }}
repo: ${{ env.repo }}
new: ${{ steps.version-check.outputs.new }}
name: build (el${{ matrix.osversion }})
runs-on: ubuntu-latest
container:
image: docker.io/lkiesow/opencast-rpmbuild:el${{ matrix.osversion }}-oc17
steps:
- uses: actions/checkout@v4
- id: version
run: echo "version=$(cat oc.version)" >> $GITHUB_OUTPUT
- name: clone opencast
run: >
git clone
https://github.com/opencast/opencast.git
- name: check if new version exists
id: version-check
working-directory: opencast
env:
S3_HOST: ${{ secrets.S3_HOST }}
run: |
git tag | grep ^${{ steps.version.outputs.version }} | sort --version-sort | tail -n1 > latest.version
curl -sO https://${S3_HOST}/opencast-pkg/rpms/release/el/${{ matrix.osversion }}/oc-${{ steps.version.outputs.version }}/noarch/rpm.version
if grep -q . latest.version; then
if diff -q latest.version rpm.version; then
echo "Commit $(cat current.commit) already built"
echo "new=no" >> "$GITHUB_OUTPUT"
else
echo "Last built $(cat latest.commit). Building new commit $(cat current.commit)"
echo "new=yes" >> "$GITHUB_OUTPUT"
fi
else
echo "No release of Opencast ${{ steps.version.outputs.version }} yet"
echo "new=no" >> "$GITHUB_OUTPUT"
fi
- name: switch to tagged opencast version
if: steps.version-check.outputs.new == 'yes'
working-directory: opencast
run: >
git checkout "$(cat latest.version)"
- name: cache local maven repository
if: steps.version-check.outputs.new == 'yes'
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: clone mvn.opencast.org
if: steps.version-check.outputs.new == 'yes'
run: |
git clone --depth 1 https://github.com/opencast/mvn.opencast.org.git
- name: prepare additional maven repository
if: steps.version-check.outputs.new == 'yes'
working-directory: opencast
run: |
sed -i "s#https://mvn.opencast.org/#file://$(readlink -f ../mvn.opencast.org)#" pom.xml
- name: build opencast
if: steps.version-check.outputs.new == 'yes'
working-directory: opencast
run: >
mvn
--batch-mode
-Dmaven.wagon.httpconnectionManager.ttlSeconds=120
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
-Dcheckstyle.skip=true
-DskipTests
clean install
- name: list distributions to build
if: steps.version-check.outputs.new == 'yes'
run: |
find opencast/build/ -type f -name 'opencast-dist-*gz' \
| sed 's/^.*opencast-dist-\([^-]*\)-.*$/\1/' \
| tee rpmbuild/SPECS/dists
- name: mimic rpmdev-setuptree
if: steps.version-check.outputs.new == 'yes'
working-directory: rpmbuild
run: |
ln -s "$(pwd)" ~/rpmbuild
- name: move build artifacts
if: steps.version-check.outputs.new == 'yes'
run: |
mv -v opencast/build/opencast-dist-*.tar.gz rpmbuild/SOURCES/
- name: define rpm version
if: steps.version-check.outputs.new == 'yes'
working-directory: opencast
run: |
echo "%octarversion $(cat latest.version)" >> ~/.rpmmacros
echo "%ocversion $(cat latest.version)" >> ~/.rpmmacros
echo "%ocrelease 1" >> ~/.rpmmacros
- name: build rpm
if: steps.version-check.outputs.new == 'yes'
working-directory: rpmbuild/SPECS
run: |
for dist in $(cat dists); do
rpmbuild -ba -D "ocdist ${dist}" opencast.spec
done
- name: list rpms
if: steps.version-check.outputs.new == 'yes'
working-directory: rpmbuild/RPMS/${{ env.arch }}
run: |
du -hs ./*.rpm
- name: prepare gpg
if: steps.version-check.outputs.new == 'yes'
env:
GPG_KEY: ${{ secrets.GPG_KEY_OC17 }}
run: |
echo "${GPG_KEY}" | gpg --import
echo '%_gpg_name [email protected]' >> ~/.rpmmacros
- name: sign rpms
if: steps.version-check.outputs.new == 'yes'
working-directory: rpmbuild/RPMS/${{ env.arch }}
run: |
rpmsign --addsign *.rpm
- uses: lkiesow/configure-s3cmd@v1
if: steps.version-check.outputs.new == 'yes'
with:
host: ${{ secrets.S3_HOST }}
access_key: ${{ secrets.S3_ACCESS_KEY }}
secret_key: ${{ secrets.S3_SECRET_KEY }}
- name: publish rpm
if: steps.version-check.outputs.new == 'yes'
working-directory: rpmbuild/RPMS/${{ env.arch }}
run: |
s3cmd put -P *.rpm "s3://opencast-pkg/rpms/${{ env.repo }}/el/${{ matrix.osversion }}/oc-${{ steps.version.outputs.version }}/${{ env.arch }}/"
- name: keep track of latest build
if: steps.version-check.outputs.new == 'yes'
working-directory: opencast
run: |
s3cmd put -P latest.version "s3://opencast-pkg/rpms/${{ env.repo }}/el/${{ matrix.osversion }}/oc-${{ steps.version.outputs.version }}/${{ env.arch }}/rpm.version"
- name: Setting up matrix-msg
if: steps.version-check.outputs.new == 'yes'
uses: lkiesow/matrix-notification@v1
with:
room: '!RACMQVfKRDQTWhdXLa:matrix.org'
token: ${{ secrets.MATRIX_TOKEN }}
tool: true
- name: Announce new package
if: steps.version-check.outputs.new == 'yes'
working-directory: opencast
run: >
echo "Finished building Opencast $(cat latest.version) RPMs (el${{ matrix.osversion }})."
"They should be available in a few minutes" | ~/.local/bin/matrix-msg
createrepo:
uses: opencast/opencast-rpmbuild/.github/workflows/createrepo.yml@develop
if: ${{ needs.build.outputs.new == 'yes' }}
needs: build
strategy:
matrix:
os-version:
- 8
- 9
with:
oc-version: ${{ needs.build.outputs.oc-version }}
os-version: ${{ matrix.os-version }}
arch: ${{ needs.build.outputs.arch }}
repo: ${{ needs.build.outputs.repo }}
secrets:
S3_HOST: ${{ secrets.S3_HOST }}
S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }}
S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }}