Add automated release workflow with changelog sync #2
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 | ||
|
Check failure on line 1 in .github/workflows/release.yml
|
||
| on: | ||
| push: | ||
| tags: | ||
| - "v*" | ||
| permissions: | ||
| contents: write | ||
| jobs: | ||
| release: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 # Full history for changelog generation | ||
| - uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.11" | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: "20" | ||
| - name: Extract version from tag | ||
| id: version | ||
| run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | ||
| - name: Update package.json version | ||
| run: | | ||
| cd packages/vscode-extension | ||
| npm version ${{ steps.version.outputs.VERSION }} --no-git-tag-version --allow-same-version | ||
| - name: Build all outputs | ||
| run: python tools/build.py | ||
| - name: Sync changelog to site | ||
| run: python tools/sync-changelog.py | ||
| - name: Build VS Code extension | ||
| run: | | ||
| cd packages/vscode-extension | ||
| npm install | ||
| npx @vscode/vsce package --no-dependencies | ||
| mv *.vsix ../../ | ||
| - name: Package dist | ||
| run: | | ||
| VERSION=${{ github.ref_name }} | ||
| tar -czf human-plus-plus-${VERSION}-dist.tar.gz dist/ | ||
| zip -r human-plus-plus-${VERSION}-dist.zip dist/ | ||
| - name: Generate changelog | ||
| id: changelog | ||
| run: | | ||
| # Get previous tag | ||
| PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "") | ||
| if [ -n "$PREV_TAG" ]; then | ||
| echo "Changes since $PREV_TAG:" | ||
| CHANGES=$(git log ${PREV_TAG}..HEAD --pretty=format:"- %s" --no-merges) | ||
| else | ||
| echo "First release" | ||
| CHANGES=$(git log --pretty=format:"- %s" --no-merges -20) | ||
| fi | ||
| # Write changelog to file (handles multiline) | ||
| echo "$CHANGES" > changelog-items.txt | ||
| - name: Generate release notes | ||
| run: | | ||
| VERSION=${{ github.ref_name }} | ||
| CHANGES=$(cat changelog-items.txt) | ||
| cat << EOF > release-notes.md | ||
| ## Human++ ${VERSION} | ||
| A Base24 color scheme for the post-artisanal coding era. | ||
| ### What's Changed | ||
| ${CHANGES} | ||
| ### Install | ||
| **VS Code / Cursor:** | ||
| Search "Human++" in extensions, or install from CLI: | ||
| \`\`\`bash | ||
| code --install-extension fielding.human-plus-plus | ||
| \`\`\` | ||
| Or download the \`.vsix\` below and install manually. | ||
| **Other Apps (with tinty):** | ||
| \`\`\`bash | ||
| tinty apply base24-human-plus-plus | ||
| \`\`\` | ||
| **Manual:** Download and extract the archive, copy configs to your app's config directory. | ||
| ### Included Configs | ||
| - \`ghostty/config\` - Ghostty terminal | ||
| - \`sketchybar/colors.sh\` - Sketchybar | ||
| - \`borders/bordersrc\` - JankyBorders | ||
| - \`skhd/modes.sh\` - skhd mode indicators | ||
| - \`base24/\` - Shell theme and tinty registry | ||
| ### Links | ||
| - [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=fielding.human-plus-plus) | ||
| - [Open VSX (Cursor)](https://open-vsx.org/extension/fielding/human-plus-plus) | ||
| - [Documentation](https://github.com/fielding/human-plus-plus) | ||
| - [Live Preview](https://fielding.github.io/human-plus-plus/) | ||
| EOF | ||
| - name: Publish to VS Code Marketplace | ||
| if: ${{ secrets.VSCE_PAT != '' }} | ||
| continue-on-error: true | ||
| env: | ||
| VSCE_PAT: ${{ secrets.VSCE_PAT }} | ||
| run: | | ||
| cd packages/vscode-extension | ||
| npx @vscode/vsce publish --no-dependencies -p $VSCE_PAT | ||
| - name: Publish to Open VSX | ||
| if: ${{ secrets.OVSX_PAT != '' }} | ||
| continue-on-error: true | ||
| env: | ||
| OVSX_PAT: ${{ secrets.OVSX_PAT }} | ||
| run: | | ||
| cd packages/vscode-extension | ||
| npx ovsx publish --no-dependencies -p $OVSX_PAT | ||
| - name: Create GitHub Release | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| body_path: release-notes.md | ||
| files: | | ||
| human-plus-plus-*.vsix | ||
| human-plus-plus-${{ github.ref_name }}-dist.tar.gz | ||
| human-plus-plus-${{ github.ref_name }}-dist.zip | ||
| - name: Commit updated files | ||
| run: | | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
| git add templates/site/index.html.tmpl packages/vscode-extension/package.json | ||
| git diff --staged --quiet || git commit -m "chore: sync changelog and version for ${{ github.ref_name }}" | ||
| git push origin HEAD:main || echo "Nothing to push" | ||