Skip to content

fix: resolve security vulnerabilities and bump version to 1.0.5 #1

fix: resolve security vulnerabilities and bump version to 1.0.5

fix: resolve security vulnerabilities and bump version to 1.0.5 #1

Workflow file for this run

name: CI/CD Pipeline
on:
push:
branches: [main, master]
tags:
- "v*"
pull_request:
branches: [main, master]
workflow_dispatch: # Allows manual triggering of the workflow
jobs:
build:
name: Build & Test
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Lint
run: pnpm run lint
- name: Compile
run: pnpm run compile
- name: Compile Tests
run: pnpm run test-compile
- name: Copy Test Runner
run: |
mkdir -p out/test
cp src/test/runTest.js out/test/
- name: Run Tests
uses: GabrielBB/xvfb-action@v1
with:
run: pnpm run test
working-directory: ${{ github.workspace }}
- name: Package Extension
run: pnpm run package
- name: Package VSIX
run: pnpm dlx vsce package --no-dependencies
- name: Upload VSIX Artifact
uses: actions/upload-artifact@v4
with:
name: package-json-manager-vsix
path: "*.vsix"
if-no-files-found: error
release:
name: Release to Marketplace & GitHub
needs: build
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
# Add permissions needed for creating releases
permissions:
contents: write
packages: write
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Download VSIX Artifact
uses: actions/download-artifact@v4
with:
name: package-json-manager-vsix
- name: Get VSIX file name
id: vsix-name
run: echo "VSIX_NAME=$(ls *.vsix)" >> $GITHUB_OUTPUT
- name: Get Version from Tag
id: get-version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Verify Package Version
run: |
PKG_VERSION=$(node -p "require('./package.json').version")
if [ "v$PKG_VERSION" != "${{ github.ref_name }}" ]; then
echo "Error: Tag version (${{ github.ref_name }}) does not match package.json version (v$PKG_VERSION)"
exit 1
fi
- name: Publish to Visual Studio Marketplace
run: pnpm dlx vsce publish --packagePath ${{ steps.vsix-name.outputs.VSIX_NAME }}
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
- name: Create GitHub Release
id: create-release
uses: softprops/action-gh-release@v1
with:
name: Release v${{ steps.get-version.outputs.VERSION }}
files: ${{ steps.vsix-name.outputs.VSIX_NAME }}
draft: false
prerelease: false
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}