feat: add Git staging event listeners and diff pre-warming #31
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 Extension | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| inputs: | |
| release-type: | |
| description: "Release type override (leave empty for automatic)" | |
| required: false | |
| default: "" | |
| type: string | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| jobs: | |
| release-please: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| release_created: ${{ steps.release.outputs.release_created }} | |
| tag_name: ${{ steps.release.outputs.tag_name }} | |
| version: ${{ steps.release.outputs.version }} | |
| body: ${{ steps.release.outputs.body }} | |
| steps: | |
| - name: Run release-please | |
| id: release | |
| uses: googleapis/release-please-action@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| config-file: release-please-config.json | |
| manifest-file: .release-please-manifest.json | |
| publish: | |
| needs: release-please | |
| if: ${{ needs.release-please.outputs.release_created == 'true' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22.x" | |
| cache: "npm" | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run type check | |
| run: npm run type-check | |
| - name: Run linter | |
| run: npm run lint:check | |
| - name: Build extension | |
| run: npm run compile | |
| - name: Run tests | |
| run: npm run test | |
| continue-on-error: true # Don't fail release if tests fail | |
| - name: Install vsce | |
| run: npm install -g @vscode/vsce | |
| - name: Package extension | |
| run: vsce package -o diffy-explain-ai-${{ needs.release-please.outputs.version }}.vsix | |
| - name: Publish to VS Code Marketplace | |
| env: | |
| VSCE_PAT: ${{ secrets.VSCE_PAT }} | |
| run: vsce publish -p $VSCE_PAT --packagePath diffy-explain-ai-${{ needs.release-please.outputs.version }}.vsix | |
| - name: Install ovsx CLI | |
| run: npm install -g ovsx | |
| - name: Create OpenVSX namespace (if not exists) | |
| env: | |
| OPENVSX_PAT: ${{ secrets.OPENVSX_PAT }} | |
| run: ovsx create-namespace hitclaw -p $OPENVSX_PAT || echo "Namespace already exists or creation failed" | |
| - name: Publish to OpenVSX | |
| env: | |
| OPENVSX_PAT: ${{ secrets.OPENVSX_PAT }} | |
| run: ovsx publish diffy-explain-ai-${{ needs.release-please.outputs.version }}.vsix -p $OPENVSX_PAT | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ needs.release-please.outputs.tag_name }} | |
| name: Release ${{ needs.release-please.outputs.tag_name }} | |
| body: ${{ needs.release-please.outputs.body }} | |
| files: diffy-explain-ai-${{ needs.release-please.outputs.version }}.vsix | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Commit CHANGELOG.md changes | |
| if: ${{ needs.release-please.outputs.release_created == 'true' }} | |
| run: | | |
| git config --global user.name 'github-actions[bot]' | |
| git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
| git add CHANGELOG.md | |
| git commit -m "chore: release ${{ needs.release-please.outputs.tag_name }} [skip ci]" || echo "No changes to commit" | |
| git push origin main | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload VSIX artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: diffy-explain-ai-${{ needs.release-please.outputs.version }} | |
| path: diffy-explain-ai-${{ needs.release-please.outputs.version }}.vsix | |
| retention-days: 90 | |
| if-no-files-found: error | |
| - name: Release summary | |
| run: | | |
| echo "## 🎉 Release Complete!" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Version**: ${{ needs.release-please.outputs.tag_name }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Extension Package**: diffy-explain-ai-${{ needs.release-please.outputs.version }}.vsix" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Marketplace**: Published ✅" >> $GITHUB_STEP_SUMMARY | |
| echo "- **OpenVSX**: Published ✅" >> $GITHUB_STEP_SUMMARY | |
| echo "- **GitHub Release**: Created ✅" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### 📦 Install" >> $GITHUB_STEP_SUMMARY | |
| echo "\`\`\`bash" >> $GITHUB_STEP_SUMMARY | |
| echo "# From VS Code Marketplace" >> $GITHUB_STEP_SUMMARY | |
| echo "code --install-extension hitclaw.diffy-explain-ai" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "# Or download VSIX from GitHub Release" >> $GITHUB_STEP_SUMMARY | |
| echo "code --install-extension diffy-explain-ai-${{ needs.release-please.outputs.version }}.vsix" >> $GITHUB_STEP_SUMMARY | |
| echo "\`\`\`" >> $GITHUB_STEP_SUMMARY |