update version #522
Workflow file for this run
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: 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 |