Skip to content

Merge pull request #72 from joshmu/feat_testing #54

Merge pull request #72 from joshmu/feat_testing

Merge pull request #72 from joshmu/feat_testing #54

name: Publish VSCode Extension
on:
push:
branches:
- master
jobs:
# Add test job dependency
test:
uses: ./.github/workflows/test.yml
semantic-release:
needs: test # Require tests to pass before release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
- name: Semantic Release
id: semantic
uses: cycjimmy/semantic-release-action@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Force patch bump if no release
if: steps.semantic.outputs.new_release_published != 'true'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
npm version patch -m "chore(release): bump version to %s [skip ci]"
git push --follow-tags
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build:
needs: semantic-release
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: windows-latest
platform: win32
arch: x64
npm_config_arch: x64
- os: windows-latest
platform: win32
arch: arm64
npm_config_arch: arm
- os: ubuntu-latest
platform: linux
arch: x64
npm_config_arch: x64
- os: ubuntu-latest
platform: linux
arch: arm64
npm_config_arch: arm64
- os: ubuntu-latest
platform: linux
arch: armhf
npm_config_arch: arm
- os: ubuntu-latest
platform: alpine
arch: x64
npm_config_arch: x64
- os: macos-latest
platform: darwin
arch: x64
npm_config_arch: x64
- os: macos-latest
platform: darwin
arch: arm64
npm_config_arch: arm64
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Checkout the latest tag
shell: pwsh
run: git checkout tags/$(git describe --tags $(git rev-list --tags --max-count=1))
- run: npm install
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
npm_config_arch: ${{ matrix.npm_config_arch }}
- shell: pwsh
run: echo "target=${{ matrix.platform }}-${{ matrix.arch }}" >> $env:GITHUB_ENV
- run: npx @vscode/vsce package --target ${{ env.target }}
- uses: actions/upload-artifact@v4
with:
name: ${{ env.target }}
path: '*.vsix'
retention-days: 1
publish:
runs-on: ubuntu-latest
needs: build
if: success()
steps:
- uses: actions/download-artifact@v4
- run: npx @vscode/vsce publish --packagePath $(find . -iname *.vsix)
env:
VSCE_PAT: ${{ secrets.VS_MARKETPLACE_TOKEN }}
- run: npx ovsx publish --packagePath $(find . -iname *.vsix)
env:
OVSX_PAT: ${{ secrets.OPEN_VSX_TOKEN }}