Release #82
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version_type: | |
| description: 'Version bump type' | |
| required: true | |
| default: 'patch' | |
| type: choice | |
| options: | |
| - patch | |
| - minor | |
| - major | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.RELEASE_PAT || secrets.GITHUB_TOKEN }} | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Upgrade npm for Trusted Publishers | |
| run: npm install -g npm@latest | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Configure git | |
| run: | | |
| git config --local user.email "${{ secrets.GIT_USER_EMAIL }}" | |
| git config --local user.name "${{ secrets.GIT_USER_NAME }}" | |
| - name: Bump version and push | |
| id: version | |
| run: | | |
| npm version ${{ github.event.inputs.version_type }} --no-git-tag-version | |
| NEW_VERSION=$(node -p "require('./package.json').version") | |
| echo "new_version=v$NEW_VERSION" >> $GITHUB_OUTPUT | |
| git add package.json | |
| git commit -m "🔖 v$NEW_VERSION" | |
| git push origin main | |
| git tag "v$NEW_VERSION" | |
| git push origin "v$NEW_VERSION" | |
| - name: Get previous version | |
| id: prev_version | |
| run: | | |
| PREV_TAG=$(git describe --tags --abbrev=0 HEAD~1 2>/dev/null || echo "") | |
| echo "tag=$PREV_TAG" >> $GITHUB_OUTPUT | |
| - name: Generate release notes with Claude | |
| id: changelog | |
| uses: anthropics/claude-code-action@v1 | |
| with: | |
| claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} | |
| prompt: | | |
| Generate release notes for Vizzly CLI ${{ steps.version.outputs.new_version }}. | |
| Context: | |
| - Previous tag: `${{ steps.prev_version.outputs.tag }}` | |
| - New version: `${{ steps.version.outputs.new_version }}` | |
| - This is the main CLI package for Vizzly visual testing | |
| Instructions: | |
| 1. Use git commands to get commits since the previous tag | |
| 2. Analyze the commits and understand what changed | |
| 3. Read relevant code changes if needed to understand the impact | |
| 4. Generate user-friendly release notes with categories: Added, Changed, Fixed, Removed | |
| 5. Focus on user-facing changes - skip internal refactors unless significant | |
| 6. Write clear, concise descriptions (not just commit messages) | |
| 7. Group related changes together | |
| Save the release notes to `RELEASE-NOTES.md` with this format: | |
| ## What's Changed | |
| ### Added | |
| - New features and capabilities | |
| ### Changed | |
| - Breaking or notable behavioral changes | |
| ### Fixed | |
| - Bug fixes | |
| ### Removed | |
| - Deprecated features removed (if any) | |
| **Full Changelog**: https://github.com/vizzly-testing/cli/compare/${{ steps.prev_version.outputs.tag }}...${{ steps.version.outputs.new_version }} | |
| Notes: | |
| - Omit empty sections | |
| - If there are no meaningful user-facing changes, just write a brief summary | |
| claude_args: '--allowed-tools "Bash(git:*),Read,Write" --model haiku' | |
| - name: Read release notes | |
| id: release_notes | |
| run: | | |
| if [ -f RELEASE-NOTES.md ]; then | |
| { | |
| echo 'notes<<RELEASE_EOF' | |
| cat RELEASE-NOTES.md | |
| echo 'RELEASE_EOF' | |
| } >> $GITHUB_OUTPUT | |
| else | |
| echo "notes=Release ${{ steps.version.outputs.new_version }}" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.version.outputs.new_version }} | |
| name: ✨ ${{ steps.version.outputs.new_version }} | |
| body: ${{ steps.release_notes.outputs.notes }} | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Publish to NPM | |
| run: npm publish --access public |