Skip to content

ci: unify github actions to node 20 and cleanup stale workflows #19

ci: unify github actions to node 20 and cleanup stale workflows

ci: unify github actions to node 20 and cleanup stale workflows #19

name: VS Code Extension

Check failure on line 1 in .github/workflows/vscode-extension.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/vscode-extension.yml

Invalid workflow file

(Line: 55, Col: 13): Unrecognized named-value: 'secrets'. Located at position 42 within expression: startsWith(github.ref, 'refs/tags/v') && secrets.VSCE_PAT != '', (Line: 61, Col: 13): Unrecognized named-value: 'secrets'. Located at position 42 within expression: startsWith(github.ref, 'refs/tags/v') && secrets.OVSX_PAT != ''
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 }}