Skip to content

Commit 4bd34e2

Browse files
authored
Fix issues with release action (#10)
1 parent 724321d commit 4bd34e2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

.github/workflows/release.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- main
7+
78
permissions:
89
contents: write # we need this to be able to push tags
910

@@ -16,6 +17,8 @@ jobs:
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')
@@ -58,6 +65,7 @@ jobs:
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 }}
@@ -69,6 +77,7 @@ jobs:
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

Comments
 (0)