-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (60 loc) · 1.62 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
name: Release
on:
push:
paths-ignore:
- '.gitignore'
- '.gitattributes'
- 'README.md'
- 'LICENSE'
# paths:
# - 'CMakeLists.txt'
# branches:
# - master
### NOTE: such a waste 2 jobs for just 2 steps, but better displayed names
### NOTE: can't be automatically triggered so publish a draft release,
### it will manually published... GitHub doesn't allow that yet.
jobs:
check:
name: Check Version
runs-on: ubuntu-22.04
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: checkVersion
run: |
set -e
VER=$(cat CMakeLists.txt | grep " VERSION " | cut -d ' ' -f 4)
TAGS=( $(git tag) )
echo "VER: ${VER}"
echo "TAGS: ${TAGS[@]}"
for t in "${TAGS[@]}"
do
#echo $t
tt=$(echo $t | cut -d'v' -f2)
#echo $tt
if [ "$VER" = "$tt" ]
then
echo "$VER is already present"
exit -1
break
fi
done
publish:
name: Publish Version
runs-on: ubuntu-22.04
if: ${{ github.ref == 'refs/heads/master' }}
needs:
- check
steps:
- uses: actions/checkout@v3
- name: publishVersion
# if: ${{ github.ref == 'refs/heads/master' }}
env:
GH_TOKEN: ${{ secrets.GH_WORKFLOW }}
run: |
set -e
VER=$(cat CMakeLists.txt | grep " VERSION " | cut -d ' ' -f 4)
echo "VER: ${VER}"
gh release create v${VER} --generate-notes