Trigger on Sat Jan 18 02:40:40 UTC 2025 #1071
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }}-oc14 | |
steps: | |
- uses: actions/checkout@v3 | |
- 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: Patch node version since el7 cannot run Node.js 18 | |
if: matrix.osversion == 7 | |
working-directory: opencast | |
run: | | |
sed -i 's/node.version>v18.16.0/node.version>v16.13.0/' pom.xml | |
- name: cache local maven repository | |
if: steps.version-check.outputs.new == 'yes' | |
uses: actions/cache@v3 | |
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_OC15 }} | |
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: | |
- 7 | |
- 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 }} |