@@ -45,80 +45,58 @@ jobs:
4545 git config --local user.email "${{ secrets.GIT_USER_EMAIL }}"
4646 git config --local user.name "${{ secrets.GIT_USER_NAME }}"
4747
48- - name : Bump version and push
48+ - name : Bump version
4949 id : version
5050 run : |
5151 npm version ${{ github.event.inputs.version_type }} --no-git-tag-version
5252
5353 NEW_VERSION=$(node -p "require('./package.json').version")
5454 echo "new_version=v$NEW_VERSION" >> $GITHUB_OUTPUT
5555
56- git add package.json
56+ git add package.json package-lock.json
5757 git commit -m "🔖 v$NEW_VERSION"
58- git push origin main
59- git tag "v$NEW_VERSION"
60- git push origin "v$NEW_VERSION"
6158
62- - name : Get previous version
59+ - name : Get previous published version
6360 id : prev_version
6461 run : |
65- PREV_TAG=$(git describe --tags --abbrev=0 HEAD~1 2>/dev/null || echo "")
62+ PUBLISHED_VERSION=$(npm view @vizzly-testing/cli version 2>/dev/null || echo "")
63+ if [ -n "$PUBLISHED_VERSION" ] && git rev-parse "v$PUBLISHED_VERSION" >/dev/null 2>&1; then
64+ PREV_TAG="v$PUBLISHED_VERSION"
65+ else
66+ PREV_TAG=$(git describe --tags --abbrev=0 HEAD~1 2>/dev/null || echo "")
67+ fi
6668 echo "tag=$PREV_TAG" >> $GITHUB_OUTPUT
6769
6870 - name : Generate release notes
69- uses : openai/codex-action@a26d2d4d8b78a694338b8e3715c3630254340b2c # v1
70- with :
71- openai-api-key : ${{ secrets.OPENAI_API_KEY }}
72- sandbox : workspace-write
73- safety-strategy : drop-sudo
74- prompt : |
75- Generate release notes for Vizzly CLI ${{ steps.version.outputs.new_version }}.
76-
77- Context:
78- - Previous tag: `${{ steps.prev_version.outputs.tag }}`
79- - New version: `${{ steps.version.outputs.new_version }}`
80- - This is the main CLI package for Vizzly visual testing.
81-
82- Instructions:
83- 1. Use git commands to inspect commits and changed files since the previous tag. If there is no previous tag, inspect the recent release commits.
84- 2. Read relevant code changes when commit messages are not enough.
85- 3. Generate user-friendly release notes with categories: Added, Changed, Fixed, Removed.
86- 4. Focus on user-facing changes. Skip internal refactors unless they affect behavior.
87- 5. Omit empty sections.
88- 6. If there are no meaningful user-facing changes, write a brief summary.
89- 7. Save the release notes to `RELEASE-NOTES.md`.
90-
91- Use this format:
92-
93- ## What's Changed
94-
95- ### Added
96- - New features and capabilities
97-
98- ### Changed
99- - Breaking or notable behavioral changes
100-
101- ### Fixed
102- - Bug fixes
103-
104- ### Removed
105- - Deprecated features removed
106-
107- **Full Changelog**: https://github.com/vizzly-testing/cli/compare/${{ steps.prev_version.outputs.tag }}...${{ steps.version.outputs.new_version }}
108-
109- - name : Read release notes
11071 id : release_notes
11172 run : |
112- if [ -f RELEASE-NOTES.md ]; then
113- {
114- echo 'notes<<RELEASE_EOF'
115- cat RELEASE-NOTES.md
116- echo 'RELEASE_EOF'
117- } >> $GITHUB_OUTPUT
73+ if [ -n "${{ steps.prev_version.outputs.tag }}" ]; then
74+ COMMITS=$(git log ${{ steps.prev_version.outputs.tag }}..HEAD --pretty=format:"- %s")
75+ CHANGELOG_URL="https://github.com/vizzly-testing/cli/compare/${{ steps.prev_version.outputs.tag }}...${{ steps.version.outputs.new_version }}"
11876 else
119- echo "notes=Release ${{ steps.version.outputs.new_version }}" >> $GITHUB_OUTPUT
77+ COMMITS=$(git log --pretty=format:"- %s" -10)
78+ CHANGELOG_URL="https://github.com/vizzly-testing/cli/releases/tag/${{ steps.version.outputs.new_version }}"
12079 fi
12180
81+ {
82+ echo 'notes<<RELEASE_EOF'
83+ echo "## What's Changed"
84+ echo
85+ echo "$COMMITS"
86+ echo
87+ echo "**Full Changelog**: $CHANGELOG_URL"
88+ echo 'RELEASE_EOF'
89+ } >> $GITHUB_OUTPUT
90+
91+ - name : Publish to NPM
92+ run : npm publish --provenance --access public
93+
94+ - name : Push version and tag
95+ run : |
96+ git push origin main
97+ git tag "${{ steps.version.outputs.new_version }}"
98+ git push origin "${{ steps.version.outputs.new_version }}"
99+
122100 - name : Create GitHub Release
123101 uses : softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 # v2
124102 with :
@@ -129,6 +107,3 @@ jobs:
129107 prerelease : false
130108 env :
131109 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
132-
133- - name : Publish to NPM
134- run : npm publish --access public
0 commit comments