Build and release #81
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: | |
repo: | |
description: 'Reva repository to be used' | |
required: true | |
default: 'cs3org' | |
branch: | |
description: 'Branch to be built' | |
required: true | |
default: 'master' | |
go-version: | |
description: 'Go version' | |
required: true | |
default: '1.21.3' | |
jobs: | |
build: | |
name: Release | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
container: [cern/alma8-base, cern/alma9-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/quincy/octopus/" /etc/yum.repos.d/ceph.repo && cp reva-release/endpoint.repo /etc/yum.repos.d/endpoint.repo && yum -y install yum-plugin-priorities && sed -i '/RemovePathPostfixes.*/d' reva-release/cernbox-revad.spec && echo "CI: adapted setup to CC7, installing related dependencies" | |
yum install -y git wget make gcc gcc-c++ rpm-build glibc-static libcephfs-devel librbd-devel librados-devel | |
- name: Install golang | |
run: | | |
wget https://go.dev/dl/go${{ inputs.go-version }}.linux-amd64.tar.gz && tar xfz go${{ inputs.go-version }}.linux-amd64.tar.gz | |
- name: Checkout reva repository | |
uses: actions/checkout@v3 | |
with: | |
repository: ${{ inputs.repo }}/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/cernbox-revad.spec reva/cernbox-revad.spec | |
- name: Create reva RPMs | |
run: | | |
set -x | |
export GOPATH=$(pwd)/go | |
export PATH=$PATH:$GOPATH/bin | |
rm -rf ~/.cache/go-build | |
cd reva | |
make -f Makefile.rpm rpm | |
mkdir /release | |
mv cernbox-*.rpm /release | |
env: | |
CGO_ENABLED: 1 | |
CONTAINER: ${{ matrix.container }} | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: cernbox-rpms | |
path: /release | |
retention-days: 1 | |
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: Bump version in spec file | |
run: | | |
export GOPATH=$(pwd)/go | |
export PATH=$PATH:$GOPATH/bin | |
cd reva | |
export REVAVER="Reva commit $(git rev-parse --short HEAD) at ${{ inputs.repo }}/${{ inputs.branch }}" | |
cd ../reva-release | |
go run prepare_release.go -author "cernbox-admins[bot]" -email "[email protected]" -reva-version "$REVAVER" | |
echo "version=$(awk '$1 == "Version:" {print $2}' cernbox-revad.spec)" >> $GITHUB_ENV | |
echo "Reva version is "\""$REVAVER"\" | |
- name: Push version | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
repository: reva-release | |
commit_message: "Version ${{ env.version }}" | |
file_pattern: cernbox-revad.spec | |
commit_user_name: CERNBox Admins Bot | |
commit_user_email: [email protected] | |
tagging_message: v${{ env.version }} | |
- name: Download artifacts | |
id: download | |
uses: actions/download-artifact@v3 | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
draft: false | |
prerelease: false | |
files: ${{ steps.download.outputs.download-path }}/cernbox-rpms/* | |
name: Version ${{ env.version }} | |
tag_name: v${{ env.version }} |