Minor update. #36
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
| on: | |
| push: | |
| branches: | |
| - main | |
| - dev | |
| # Sequence of patterns matched against refs/tags | |
| tags: | |
| - "v*" # Push events to matching v*, i.e. v1.0, v20.15.10 | |
| name: Create Release | |
| jobs: | |
| build: | |
| name: Create Release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Setup node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: .node-version | |
| cache: npm | |
| - name: VSCE package | |
| run: | | |
| npm ci | |
| npx vsce package | |
| - name: Parse tag string | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| id: tag_version | |
| run: | | |
| echo "result=${GITHUB_REF#refs/*/v}" >> $GITHUB_OUTPUT | |
| - name: Parse version in package.json | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| id: package_version | |
| run: | | |
| echo "result=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT | |
| - name: Check if tag matches to package version | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: | | |
| echo "TAG=${{ steps.tag_version.outputs.result }}" | |
| echo "PACKAGE=${{ steps.package_version.outputs.result }}" | |
| if [ "${{ steps.tag_version.outputs.result }}" != "${{ steps.package_version.outputs.result }}" ]; then | |
| echo "Tag version does not match package.json version" | |
| exit 1 | |
| fi | |
| - name: GitHub Releases | |
| if: startsWith(github.ref, 'refs/tags/v') && steps.tag_version.outputs.result == steps.package_version.outputs.result | |
| uses: softprops/action-gh-release@v3 | |
| with: | |
| files: ./vscode-3d-preview-${{ steps.tag_version.outputs.result }}.vsix | |
| draft: false | |
| prerelease: false | |
| - name: Publish to VS Code Marketplace | |
| if: startsWith(github.ref, 'refs/tags/v') && steps.tag_version.outputs.result == steps.package_version.outputs.result | |
| run: npx vsce publish -p ${{ secrets.VSCODE_TOKEN }} |