(release) 0.4.0 #1
Workflow file for this run
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: Publish Extension | |
| on: | |
| push: | |
| tags: | |
| - '[0-9]+.[0-9]+.[0-9]+' | |
| permissions: | |
| contents: read | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Compile TypeScript | |
| run: npm run compile | |
| - name: Install vsce and ovsx | |
| run: | | |
| npm install -g @vscode/vsce | |
| npm install -g @openvsx/publish-cli | |
| - name: Package extension | |
| run: npm run package | |
| id: package | |
| - name: Get version from tag or input | |
| id: version | |
| run: | | |
| if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | |
| echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT | |
| else | |
| VERSION=${GITHUB_REF#refs/tags/v} | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Update package.json version | |
| if: github.event_name == 'workflow_dispatch' | |
| run: | | |
| npm version ${{ github.event.inputs.version }} --no-git-tag-version | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add package.json | |
| git commit -m "Bump version to ${{ github.event.inputs.version }}" || exit 0 | |
| git push || exit 0 | |
| - name: Publish to VS Code Marketplace | |
| env: | |
| VSCE_TOKEN: ${{ secrets.VSCE_TOKEN }} | |
| run: | | |
| vsce publish -p $VSCE_TOKEN | |
| - name: Publish to OpenVSX Registry | |
| env: | |
| OVSX_PAT: ${{ secrets.OVSX_TOKEN }} | |
| run: | | |
| ovsx publish -p $OVSX_TOKEN | |
| - name: Upload VSIX artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: extension-vsix | |
| path: '*.vsix' | |
| retention-days: 30 | |
| - name: Announce release on Zulip | |
| if: success() | |
| env: | |
| ZULIP_BOT_TOKEN: ${{ secrets.ZULIP_RELEASES_BOT_TOKEN }} | |
| run: | | |
| chmod +x scripts/announce-release.sh | |
| ./scripts/announce-release.sh "${{ steps.version.outputs.version }}" "${{ secrets.ZULIP_RELEASES_BOT_TOKEN }}" |