Build and release #39
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 and release | |
on: | |
workflow_dispatch: | |
inputs: | |
branch: | |
description: 'Branch of the cernbox/reva repository' | |
required: true | |
default: 'cernbox' | |
jobs: | |
build: | |
name: Release | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
container: [cern/cc7-base, cern/alma8-base] | |
permissions: | |
contents: write | |
container: ${{ matrix.container }} | |
steps: | |
- name: Checkout release repository | |
uses: actions/checkout@v3 | |
with: | |
path: reva-release | |
- name: Install build infrastructure | |
run: | | |
source /etc/os-release | |
OSMAJ="$(echo $VERSION_ID | cut -c1)" | |
cat reva-release/ceph.repo.in | sed "s/OSMAJOR/$OSMAJ/" > /etc/yum.repos.d/ceph.repo | |
[[ $OSMAJ -eq "7" ]] && sed -i "s/pacific/octopus/" /etc/yum.repos.d/ceph.repo && yum -y install yum-plugin-priorities && sed -i '/RemovePathPostfixes.*/d' reva-release/revad.spec | |
yum install -y golang git make rpm-build glibc-static libcephfs-devel librbd-devel librados-devel | |
- name: Bump version in spec file | |
run: | | |
cd reva-release | |
go run prepare_release.go -author "cernbox-admins[bot]" -email "cernbox-admins@cern.ch" | |
echo "version=$(awk '$1 == "Version:" {print $2}' revad.spec)" >> $GITHUB_ENV | |
- name: Checkout reva repository | |
uses: actions/checkout@v3 | |
with: | |
repository: cernbox/reva | |
path: reva | |
ref: ${{ inputs.branch }} | |
- name: Copy necessary files for building the RPMs | |
run: | | |
cp reva-release/Makefile reva/Makefile.rpm | |
cp reva-release/revad.spec reva/revad.spec | |
- name: Create reva RPMs | |
run: | | |
rm -rf ~/.cache/go-build | |
cd reva | |
make -f Makefile.rpm rpm | |
mkdir /release | |
mv cernbox-revad*.rpm /release/ | |
env: | |
CGO_ENABLED: 1 | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
draft: false | |
prerelease: false | |
files: /release/cernbox-revad*.rpm | |
name: Version ${{ env.version }} | |
tag_name: v${{ env.version }} | |
reporelease: | |
needs: build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
container: golang:1.20 | |
steps: | |
- name: Checkout release repository | |
uses: actions/checkout@v3 | |
with: | |
path: reva-release | |
- name: Push version to repo | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
repository: reva-release | |
commit_message: "Version ${{ env.version }}" | |
file_pattern: revad.spec | |
commit_user_name: CERNBox Admins Bot | |
commit_user_email: cernbox-admins@cern.ch | |
tagging_message: v${{ env.version }} |