chore: version extension (#13) #16
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: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| concurrency: | |
| group: release-${{ github.ref }} | |
| cancel-in-progress: false | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| release: | |
| name: Changesets and Marketplace | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | |
| with: | |
| node-version: 26 | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Create or update version pull request | |
| id: changesets | |
| uses: changesets/action@a45c4d594aa4e2c509dc14a9f2b3b67ba3780d0d # v1.9.0 | |
| with: | |
| version: npm run version | |
| commit: 'chore: version extension' | |
| title: 'chore: version extension' | |
| commitMode: github-api | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Determine release version | |
| if: steps.changesets.outputs.hasChangesets == 'false' | |
| id: release | |
| shell: bash | |
| run: | | |
| version="$(node -p "require('./package.json').version")" | |
| tag="v${version}" | |
| echo "version=${version}" >> "$GITHUB_OUTPUT" | |
| echo "tag=${tag}" >> "$GITHUB_OUTPUT" | |
| if git rev-parse --verify --quiet "refs/tags/${tag}" >/dev/null; then | |
| echo "publish=false" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "publish=true" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Validate and package extension | |
| if: steps.release.outputs.publish == 'true' | |
| run: npm run package | |
| - name: Publish to Visual Studio Marketplace | |
| if: steps.release.outputs.publish == 'true' | |
| env: | |
| VSCE_PAT: ${{ secrets.VSCE_PAT }} | |
| run: npx vsce publish --packagePath "poolside-copilot-chat-${{ steps.release.outputs.version }}.vsix" --skip-duplicate | |
| - name: Create GitHub release | |
| if: steps.release.outputs.publish == 'true' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release create "${{ steps.release.outputs.tag }}" \ | |
| "poolside-copilot-chat-${{ steps.release.outputs.version }}.vsix" \ | |
| --target "$GITHUB_SHA" \ | |
| --title "${{ steps.release.outputs.tag }}" \ | |
| --generate-notes |