This repository was archived by the owner on Feb 26, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515 steps :
1616 - name : Checkout code
1717 uses : actions/checkout@v3
18+ with :
19+ fetch-depth : 0
1820
1921 - name : Set up Node.js
2022 uses : actions/setup-node@v3
3638 - name : Get the latest tag
3739 id : get_tag
3840 run : |
39- latest_tag=$(git describe --tags $(git rev-list --tags --max-count=1) 2>/dev/null || echo "v0.0.0")
41+ latest_tag=$(git describe --tags $(git rev-list --tags --max-count=1) 2>/dev/null)
42+ if [ -z "$latest_tag" ]; then
43+ latest_tag="v0.0.0"
44+ fi
4045 echo "latest_tag=$latest_tag" >> $GITHUB_ENV
4146
4247 - name : Determine version increment
@@ -74,13 +79,23 @@ jobs:
7479 git config user.name "github-actions[bot]"
7580 git config user.email "github-actions[bot]@users.noreply.github.com"
7681
82+ - name : Check if tag exists on remote
83+ id : check_tag
84+ run : |
85+ if git rev-parse "refs/tags/${{ env.new_tag }}" >/dev/null 2>&1; then
86+ echo "Tag ${{ env.new_tag }} already exists."
87+ exit 0
88+ fi
89+
7790 - name : Create new tag
91+ if : steps.check_tag.outcome == 'success'
7892 id : create_tag
7993 run : |
8094 git tag ${{ env.new_tag }}
8195 git push origin ${{ env.new_tag }}
8296
8397 - name : Create GitHub Release
98+ if : steps.create_tag.outcome == 'success'
8499 id : create_release
85100 uses : actions/create-release@v1
86101 with :
You can’t perform that action at this time.
0 commit comments