forked from michaeltchapman/confd-rpm
-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (65 loc) · 2.06 KB
/
build-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
# .github/workflows/build-release.yml
name: Build Release
on:
push:
tags:
- 'r[0-9]+'
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
arch: [x86_64, aarch64]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up variables
run: |
GIT_DATE=$(git -P log -1 --pretty=%cd --date=format:%Y%m%d)
GIT_HASH=$(git rev-parse --short HEAD)
TAG=${GITHUB_REF#refs/tags/}
RELEASE=${TAG#r}
echo GIT_DATE=$GIT_DATE >>$GITHUB_ENV
echo GIT_HASH=$GIT_HASH >>$GITHUB_ENV
echo RELEASE=$RELEASE >>$GITHUB_ENV
- name: Build the RPM package
run: ./build-rpm --define "git_date $GIT_DATE" --define "git_hash $GIT_HASH" --target ${{ matrix.arch }}
- name: Determine the name of the RPM package file
run: |
set -x
ls -la .
ls -la RPMS
ls -la RPMS/${{ matrix.arch }}
ls -la RPMS/${{ matrix.arch }}/confd-*.${GIT_DATE}git${GIT_HASH}.${{ matrix.arch }}.rpm
RPM_PATH=RPMS/${{ matrix.arch }}/confd-*.${GIT_DATE}git${GIT_HASH}.${{ matrix.arch }}.rpm
RPM_NAME=${RPM_PATH##*/}
tee -a $GITHUB_ENV <<<RPM_PATH=$RPM_PATH
tee -a $GITHUB_ENV <<<RPM_NAME=$RPM_NAME
- name: Upload `confd`
uses: actions/upload-artifact@v4
with:
name: ${{ env.RPM_NAME }}
path: ${{ env.RPM_PATH }}
publish:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download `confd`
uses: actions/download-artifact@v4
with:
# Files will be downloaded to `release/$name/$name`
path: release
- name: Fix downloaded `confd` paths
working-directory: release
run: |
for d in */; do
mv -v "$d" tmp
mv -v tmp/* .
rm -frv tmp
done
- name: Create release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: release/*
# vim:set sw=2 ts=2 et: