create high contrast theme #5
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: Package VS Code extension | |
| on: | |
| push: | |
| branches: [ main ] | |
| tags: ['v*'] | |
| workflow_dispatch: | |
| inputs: | |
| publish: | |
| description: 'Publish to VS Code Marketplace (true/false)' | |
| required: false | |
| default: 'false' | |
| jobs: | |
| package: | |
| name: Package with vsce | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Use Node.js 20 | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Install dependencies (if any) | |
| run: | | |
| if [ -f package.json ]; then npm ci; fi | |
| - name: Install vsce | |
| run: npm install -g vsce | |
| - name: Package extension | |
| id: package | |
| run: | | |
| # create package and capture produced filename | |
| set -o pipefail | |
| if vsce package; then | |
| echo "vsix_file=$(ls -1 *.vsix | head -n 1)" >> $GITHUB_OUTPUT | |
| else | |
| echo "global vsce failed, trying npx @vscode/vsce..." | |
| npx --yes @vscode/vsce package | |
| echo "vsix_file=$(ls -1 *.vsix | head -n 1)" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Upload VSIX artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: easyjade-vsix | |
| path: ${{ steps.package.outputs.vsix_file }} | |
| - name: Create GitHub Release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| release_name: ${{ github.ref_name }} | |
| body: "Automated package for ${{ github.ref_name }}" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload VSIX to Release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| uses: actions/upload-release-asset@v1 | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ${{ steps.package.outputs.vsix_file }} | |
| asset_name: ${{ steps.package.outputs.vsix_file }} | |
| asset_content_type: application/octet-stream | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Publish to VS Code Marketplace | |
| if: ${{ startsWith(github.ref, 'refs/tags/') || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish == 'true') }} | |
| env: | |
| VSCE_PAT: ${{ secrets.VSCE_PAT }} | |
| run: | | |
| if [ -z "$VSCE_PAT" ]; then | |
| echo "VSCE_PAT secret not set; skipping publish" | |
| exit 1 | |
| fi | |
| npx --yes @vscode/vsce publish --pat $VSCE_PAT |