chore: auto formatting #89
This file contains 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
# Deploy VSX Extension | |
# Based on: https://github.com/HaaLeo/publish-vscode-extension | |
name: Build and deploy Extension | |
on: [push, pull_request] | |
env: | |
NODE_VERSION: '20.x' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
outputs: | |
vsixName: ${{ steps.packageExtension.outputs.vsixPath }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Install pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 9 | |
run_install: false | |
- name: Get pnpm store directory | |
id: pnpm-cache | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
- name: Setup pnpm cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm install | |
- name: Run update-grammar script | |
run: pnpm run update-grammar | |
- name: Commit changes to tmLanauge.json files | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add *.tmLanguage.json | |
FILE_DIFF=$(git diff --cached --name-only --diff-filter=d) | |
if [[ $FILE_DIFF == *".tmLanguage.json"* ]]; then | |
git commit -m "Update grammar [skip ci]" | |
git push | |
fi | |
# Check (and update if necessary) package.json version | |
- name: Check package version | |
uses: technote-space/[email protected] | |
- name: Package extension .vsix | |
id: packageExtension | |
uses: HaaLeo/publish-vscode-extension@v1 | |
with: | |
pat: stub | |
dryRun: true | |
dependencies: false | |
- name: Upload extension artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: openscad-vsix | |
path: ${{ steps.packageExtension.outputs.vsixPath }} | |
release: | |
runs-on: ubuntu-latest | |
needs: [build] | |
if: startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download artifact | |
id: download | |
uses: actions/[email protected] | |
with: | |
name: openscad-vsix | |
- name: Create release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: ${{ steps.download.outputs.download-path }}/${{ needs.build.outputs.vsixName }} | |
# Pulbish to Open VSX Registry | |
- name: Publish to Open VSX Registry | |
uses: HaaLeo/publish-vscode-extension@v1 | |
id: publishToOpenVSX | |
with: | |
pat: ${{ secrets.OPEN_VSX_TOKEN }} | |
extensionFile: ${{ steps.download.outputs.download-path }}/${{ needs.build.outputs.vsixName }} | |
registryUrl: https://open-vsx.org | |
# Publish to VS Marketplace | |
- name: Publish to Visual Studio Marketplace | |
uses: HaaLeo/publish-vscode-extension@v1 | |
with: | |
pat: ${{ secrets.VS_MARKETPLACE_TOKEN }} | |
extensionFile: ${{ steps.download.outputs.download-path }}/${{ needs.build.outputs.vsixName }} | |
registryUrl: https://marketplace.visualstudio.com |