Publish VSCode Extension #1
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 VSCode Extension | |
| on: | |
| push: | |
| tags: | |
| - 'plugin-v*.*.*' | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version to publish (e.g., 1.0.0)' | |
| required: true | |
| islversion: | |
| description: 'Version of ISL to include in the publish (e.g., 1.0.0)' | |
| required: true | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Resolve ISL version | |
| id: isl-version | |
| run: | | |
| if [ -n "${{ github.event.inputs.islversion }}" ]; then | |
| echo "islVersion=${{ github.event.inputs.islversion }}" >> $GITHUB_OUTPUT | |
| elif [[ "${{ github.ref }}" == refs/tags/plugin-v* ]]; then | |
| ISL_VER="${GITHUB_REF#refs/tags/plugin-v}" | |
| echo "islVersion=$ISL_VER" >> $GITHUB_OUTPUT | |
| else | |
| ISL_VER=$(grep "^version=" gradle.properties 2>/dev/null | cut -d'=' -f2 | tr -d '\r' || echo "1.1.0") | |
| echo "islVersion=$ISL_VER" >> $GITHUB_OUTPUT | |
| fi | |
| echo "Using ISL version: $(grep islVersion $GITHUB_OUTPUT | cut -d'=' -f2)" | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'corretto' | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Build ISL runtime from Maven Central | |
| run: ./gradlew :plugin:build-isl-runtime:buildIslRuntime -PislVersion=${{ steps.isl-version.outputs.islVersion }} --no-daemon | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| cache: 'npm' | |
| cache-dependency-path: plugin/package-lock.json | |
| - name: Install dependencies | |
| working-directory: plugin | |
| run: npm ci | |
| - name: Compile TypeScript | |
| working-directory: plugin | |
| run: npm run compile | |
| - name: Run tests (if available) | |
| working-directory: plugin | |
| run: npm test || echo "No tests configured" | |
| continue-on-error: true | |
| - name: Package extension | |
| working-directory: plugin | |
| run: npx vsce package | |
| - name: Publish to VSCode Marketplace | |
| if: startsWith(github.ref, 'refs/tags/plugin-v') | |
| working-directory: plugin | |
| env: | |
| VSCE_PAT: ${{ secrets.VSCE_TOKEN }} | |
| run: npx vsce publish -p $VSCE_PAT | |
| - name: Publish to Open VSX Registry | |
| if: startsWith(github.ref, 'refs/tags/plugin-v') | |
| working-directory: plugin | |
| env: | |
| OVSX_PAT: ${{ secrets.OVSX_TOKEN }} | |
| run: npx ovsx publish -p $OVSX_PAT | |
| continue-on-error: true | |
| - name: Upload VSIX artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: isl-language-support-vsix | |
| path: plugin/*.vsix | |
| retention-days: 90 | |
| - name: Create GitHub Release | |
| if: startsWith(github.ref, 'refs/tags/plugin-v') | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: plugin/*.vsix | |
| generate_release_notes: true | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |