Skip to content

Commit ce11fca

Browse files
committed
Enhance GitHub Actions workflow for publishing by adding fetch-depth option and checking for existing releases before creation
1 parent 455f2f5 commit ce11fca

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

.github/workflows/publish.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ jobs:
1616
steps:
1717
- name: Checkout code
1818
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
1921

2022
- name: Setup Node.js
2123
uses: actions/setup-node@v4
@@ -55,11 +57,19 @@ jobs:
5557
run: |
5658
TAG="${{ steps.version.outputs.tag }}"
5759
BODY="${{ steps.tag_message.outputs.message }}"
58-
gh release create "$TAG" \
60+
61+
# Check if release already exists
62+
if gh release view "$TAG" &>/dev/null; then
63+
echo "Release $TAG already exists, skipping creation"
64+
exit 0
65+
fi
66+
67+
# Create release using GitHub CLI
68+
echo "$BODY" | gh release create "$TAG" \
5969
--title "Release $TAG" \
60-
--notes "$BODY"
70+
--notes-file -
6171
env:
62-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72+
GITHUB_TOKEN: ${{ github.token }}
6373

6474
- name: Update package.json version (CI only, not committed)
6575
run: |

0 commit comments

Comments
 (0)