-
Notifications
You must be signed in to change notification settings - Fork 3
119 lines (116 loc) · 4.16 KB
/
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
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
id: reva-rpms
run: |
set -x
export GOPATH=$(pwd)/go
export PATH=$PATH:$GOPATH/bin
rm -rf ~/.cache/go-build
cd reva
echo revaVer="Reva commit $(git rev-parse --short HEAD) at ${{ inputs.repo }}/${{ inputs.branch }}" >> "$GITHUB_OUTPUT"
make -f Makefile.rpm rpm
mkdir /release
mv cernbox-*.rpm /release
env:
CGO_ENABLED: 1
CONTAINER: ${{ matrix.container }}
outputs:
revaVer: ${{ steps.reva-rpms.outputs.revaVer }}
- 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
env:
REVAVER: ${{ needs.build.outputs.revaVer }}
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
echo "Reva version was '$REVAVER'"
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
- 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 }}