ci: unify github actions to node 20 and cleanup stale workflows #19
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: VS Code Extension | ||
|
Check failure on line 1 in .github/workflows/vscode-extension.yml
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| tags: | ||
| - "v*" | ||
| paths: | ||
| - "extensions/vscode/**" | ||
| - ".github/workflows/vscode-extension.yml" | ||
| pull_request: | ||
| paths: | ||
| - "extensions/vscode/**" | ||
| - ".github/workflows/vscode-extension.yml" | ||
| workflow_dispatch: | ||
| jobs: | ||
| build-and-publish: | ||
| name: Build, Package and Publish | ||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| working-directory: extensions/vscode | ||
| steps: | ||
| - name: Checkout Code | ||
| uses: actions/checkout@v4 | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 20 | ||
| cache: "npm" | ||
| cache-dependency-path: extensions/vscode/package-lock.json | ||
| - name: Install Dependencies | ||
| run: npm ci | ||
| - name: Compile | ||
| run: npm run compile | ||
| - name: Package Extension | ||
| run: npx vsce package | ||
| # vsce package will generate a .vsix file in the current directory (extensions/vscode) | ||
| - name: Upload Artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: typedown-vscode-extension | ||
| path: extensions/vscode/*.vsix | ||
| if-no-files-found: error | ||
| - name: Publish to VS Code Marketplace | ||
| if: startsWith(github.ref, 'refs/tags/v') && secrets.VSCE_PAT != '' | ||
| env: | ||
| VSCE_PAT: ${{ secrets.VSCE_PAT }} | ||
| run: npx vsce publish | ||
| - name: Publish to Open VSX | ||
| if: startsWith(github.ref, 'refs/tags/v') && secrets.OVSX_PAT != '' | ||
| env: | ||
| OVSX_PAT: ${{ secrets.OVSX_PAT }} | ||
| run: npx ovsx publish ./*.vsix --pat ${{ secrets.OVSX_PAT }} | ||