-
Notifications
You must be signed in to change notification settings - Fork 42
Implement GitHub release creation in CI workflow #730
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -91,3 +91,32 @@ jobs: | |
| - name: Publish to npm | ||
| if: github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]' | ||
| run: npm publish --tag latest | ||
|
|
||
| github-release: | ||
| needs: [npm-publish-latest] | ||
| runs-on: ubuntu-latest | ||
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Create GitHub release with generated notes | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| TAG="v$(node -p "require('./package.json').version")" | ||
|
|
||
| if gh release view "$TAG" >/dev/null 2>&1; then | ||
| echo "Release $TAG already exists. Skipping." | ||
| exit 0 | ||
| fi | ||
|
|
||
| if git ls-remote --exit-code --tags origin "refs/tags/$TAG" >/dev/null 2>&1; then | ||
| echo "Tag $TAG already exists on origin. Creating release from existing tag." | ||
| gh release create "$TAG" --verify-tag --generate-notes | ||
| else | ||
| echo "Creating tag and release $TAG from commit $GITHUB_SHA." | ||
| gh release create "$TAG" --target "$GITHUB_SHA" --generate-notes | ||
|
Comment on lines
+117
to
+121
|
||
| fi | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The TAG assignment uses nested double-quotes (
TAG="v$(node -p "require('./package.json').version")"), which will be parsed incorrectly by bash and fail before the release logic runs. Use single-quotes around the Node expression or otherwise escape the inner quotes so the command substitution is valid.