Move grammar sources into a dedicated directory, fix tree-sitter gram… #145
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] | |
| tags: ["!**"] | |
| paths: ["packages/vscode-plugin/**"] | |
| name: Publish VSC Extension | |
| jobs: | |
| # Note: this doesn't parse the versions, rather, it only checks if the versions are different. | |
| version-check: | |
| name: "Verify version change" | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version-changed: ${{ steps.compare_versions.outputs.changed }} | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 2 | |
| - name: Compare package.json versions | |
| working-directory: ./packages/vscode-plugin | |
| id: compare_versions | |
| run: | | |
| # jq -r returns raw string | |
| CURRENT_VERSION=$(jq -r .version package.json) | |
| PREVIOUS_VERSION=$(git show HEAD~1:./package.json | jq -r .version) | |
| echo "Current version: ${CURRENT_VERSION}" | |
| echo "Previous version: ${PREVIOUS_VERSION}" | |
| if [ "${CURRENT_VERSION}" == "${PREVIOUS_VERSION}" ]; then | |
| echo "::notice::Version number not changed, skipping publish..." | |
| echo "changed=false" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "::notice::Version was changed: ${PREVIOUS_VERSION} -> ${CURRENT_VERSION}" | |
| echo "changed=true" >> "$GITHUB_OUTPUT" | |
| fi | |
| build: | |
| needs: version-check | |
| if: needs.version-check.outputs.version-changed == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| cache: "pnpm" | |
| - name: Install deps w/ pnpm | |
| working-directory: ./packages/vscode-plugin | |
| run: pnpm install | |
| - name: Build VSIX | |
| working-directory: ./packages/vscode-plugin | |
| run: pnpm run build-and-package | |
| - name: Upload VSIX | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: vscode-plugin VSIX | |
| path: ./packages/vscode-plugin/*.vsix | |
| publish-vsm: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Download VSIX | |
| uses: actions/download-artifact@v5 | |
| with: | |
| name: vscode-plugin VSIX | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - name: Publish to VSM | |
| run: pnpx -- @vscode/vsce publish -i *.vsix | |
| env: | |
| VSCE_PAT: ${{ secrets.VSM_TOKEN }} | |
| publish-ovsx: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Download VSIX | |
| uses: actions/download-artifact@v5 | |
| with: | |
| name: vscode-plugin VSIX | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - name: Publish to OVSX | |
| run: pnpx ovsx publish *.vsix | |
| env: | |
| OVSX_PAT: ${{ secrets.OVSX_TOKEN }} |