Managed native tools #93
Workflow file for this run
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
name: Build | |
# inspired by https://github.com/HaaLeo/vscode-timing/blob/master/.github/workflows/cicd.yml | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- "*" | |
pull_request: | |
branches: | |
- main | |
release: | |
types: | |
- published | |
jobs: | |
build: | |
name: Node ${{ matrix.node }} on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 10 | |
strategy: | |
fail-fast: true | |
matrix: | |
os: | |
- ubuntu-latest | |
node: | |
- 20 | |
outputs: | |
vsixPath: ${{ steps.packageExtension.outputs.vsixPath }} | |
steps: | |
- name: Checkout Source | |
uses: actions/checkout@v4 | |
- name: Install Node ${{ matrix.node }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node }} | |
- name: Get npm cache directory | |
id: npm-cache-dir | |
shell: bash | |
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT} | |
- name: Restore NPM cache | |
id: npm-cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.npm-cache-dir.outputs.dir }} | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install Dependencies | |
run: npm ci | |
- name: Package Extension | |
id: packageExtension | |
uses: HaaLeo/publish-vscode-extension@v1 | |
with: | |
pat: stub | |
dryRun: true | |
preRelease: ${{ github.event_name != 'release' || github.event.release.prerelease }} | |
- name: Upload Extension Package as Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.os }} | |
path: ${{ steps.packageExtension.outputs.vsixPath }} | |
publish: | |
name: Publish | |
needs: | |
- build | |
if: github.event_name == 'release' | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout Source | |
uses: actions/checkout@v4 | |
- name: Download Build Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: ubuntu-latest | |
- name: GitHub Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
generate_release_notes: true | |
name: ${{ github.ref_name }} | |
fail_on_unmatched_files: true | |
files: ${{ needs.build.outputs.vsixPath }} | |
- name: Publish to Visual Studio Marketplace | |
uses: HaaLeo/publish-vscode-extension@v1 | |
with: | |
pat: ${{ secrets.VS_MARKETPLACE_TOKEN }} | |
extensionFile: ${{ needs.build.outputs.vsixPath }} | |
preRelease: ${{ github.event_name != 'release' || github.event.release.prerelease }} | |
registryUrl: https://marketplace.visualstudio.com |