44 push :
55 branches :
66 - main
7+
78permissions :
89 contents : write # we need this to be able to push tags
910
1617 uses : actions/checkout@v4
1718 with :
1819 ssh-key : ${{ secrets.PUSH_KEY }}
20+ fetch-tags : true
21+ fetch-depth : 0
1922
2023 - name : Read and validate VERSION
2124 id : version
@@ -32,17 +35,21 @@ jobs:
3235 if : contains(env.version, '-dev')
3336 run : |
3437 echo "Skipping development version release: ${{ env.version }}"
38+ echo "SKIP=true" >> $GITHUB_ENV
3539 exit 0
3640
3741 - name : Check if VERSION is already tagged
3842 id : check_tag
3943 run : |
4044 if git rev-parse "refs/tags/${{ env.version }}" >/dev/null 2>&1; then
4145 echo "Tag ${{ env.version }} already exists. Skipping release."
46+ echo "SKIP=true" >> $GITHUB_ENV
4247 exit 0
4348 fi
49+ echo "Tag ${{ env.version }} doesn't exists. Proceeding with release."
4450
4551 - name : Create Git tag
52+ if : ${{ env.SKIP != 'true' }}
4653 run : |
4754 AUTHOR_NAME=$(git log -1 --pretty=format:'%an')
4855 AUTHOR_EMAIL=$(git log -1 --pretty=format:'%ae')
5865 git push origin "${{ env.version }}"
5966
6067 - name : Create GitHub release
68+ if : ${{ env.SKIP != 'true' }}
6169 uses : softprops/action-gh-release@v2
6270 with :
6371 tag_name : ${{ env.version }}
6977 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
7078
7179 - name : Push dev VERSION
80+ if : ${{ env.SKIP != 'true' }}
7281 run : |
7382 echo "${{ env.version }}-dev" > VERSION
7483 git config user.name "${{ env.AUTHOR_NAME }}"
0 commit comments