Skip to content

ci: fix package job on force push #101

ci: fix package job on force push

ci: fix package job on force push #101

Workflow file for this run

name: CI
on:
merge_group:
types: [checks_requested]
pull_request:
push:
branches:
- main
tags:
- '**'
env:
PACKAGE_NAME: jsonpath-notebook-${{ github.sha }}-${{ github.run_id }}-${{ github.run_number }}.vsix
RELEASE_NAME: jsonpath-notebook-${{ github.ref_name }}.vsix
jobs:
test:
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'npm'
- run: npm install
- run: xvfb-run -a npm test
if: runner.os == 'Linux'
- run: npm test
if: runner.os != 'Linux'
package:
if: github.ref_name == 'main'
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'npm'
- run: npm install
- run: npm run package -- --no-yarn -o "${{ env.PACKAGE_NAME }}" # -- is used to pass arguments to the script
- uses: actions/upload-artifact@v4
with:
name: package
path: ./${{ env.PACKAGE_NAME }}
release:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
permissions:
contents: write
needs: package
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'npm'
- run: npm install
- name: Publish
run: npm run deploy
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
- name: Download package artifact
uses: actions/download-artifact@v4
with:
name: package
- name: Copy package with version name
run: cp ./${{ env.PACKAGE_NAME }} ./${{ env.RELEASE_NAME }}
- name: Read Changelog
id: changelog
uses: mindsers/changelog-reader-action@v2
- name: Create Github Release
uses: ncipollo/release-action@v1
with:
body: ${{ steps.changelog.outputs.changes }}
artifacts: ./${{ env.RELEASE_NAME }}