Skip to content

Commit ad18585

Browse files
Merge pull request #48 from pantharshit007/update/release-tag-workflow
2 parents ea568fb + e8b1862 commit ad18585

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

.github/workflows/release-tag.yml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,36 @@ jobs:
2626
echo "Version from package.json: $VERSION"
2727
echo "version=$VERSION" >> $GITHUB_OUTPUT
2828
29-
- name: Check if tag already exists
29+
- name: Fetch tags from origin
30+
run: |
31+
git fetch --tags --prune
32+
33+
- name: Check if tag already exists (remote)
3034
id: check
3135
run: |
3236
TAG="v${{ steps.pkg.outputs.version }}"
33-
if git rev-parse "$TAG" >/dev/null 2>&1; then
34-
echo "Tag $TAG already exists. Skipping."
37+
echo "Checking for tag $TAG on remote..."
38+
if git ls-remote --tags origin "$TAG" | grep -q "$TAG"; then
39+
echo "Tag $TAG already exists on remote. Skipping."
3540
echo "exists=true" >> $GITHUB_OUTPUT
3641
else
37-
echo "exists=false" >> $GITHUB_OUTPUT
42+
# also check locally as a fallback
43+
if git rev-parse "$TAG" >/dev/null 2>&1; then
44+
echo "Tag $TAG already exists locally. Skipping."
45+
echo "exists=true" >> $GITHUB_OUTPUT
46+
else
47+
echo "exists=false" >> $GITHUB_OUTPUT
48+
fi
3849
fi
3950
40-
- name: Create and push tag
51+
- name: Create and push annotated tag
4152
if: steps.check.outputs.exists == 'false'
4253
run: |
4354
git config user.name "github-actions"
4455
git config user.email "github-actions@github.com"
4556
4657
TAG="v${{ steps.pkg.outputs.version }}"
47-
git tag "$TAG"
58+
git tag -a "$TAG" -m "Release $TAG"
4859
git push origin "$TAG"
4960
5061
- name: Create GitHub release
@@ -57,6 +68,6 @@ jobs:
5768
🚀 **Automatic Release**
5869
5970
Version: v${{ steps.pkg.outputs.version }}
60-
Triggered by merge into \`prod\`.
71+
Triggered by merge into `prod`.
6172
6273
Commit: ${{ github.sha }}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "aether-ui",
3-
"version": "0.1.6",
3+
"version": "0.1.7",
44
"private": true,
55
"scripts": {
66
"dev": "next dev --turbopack",

0 commit comments

Comments
 (0)