diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 9ad5529..dc18eb7 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -12,7 +12,13 @@ permissions: contents: write jobs: - build-and-release: + build-and-test: + uses: ./.github/workflows/build-test.yml + with: + draft-check: false + + release: + needs: build-and-test runs-on: ubuntu-latest steps: - name: Checkout code @@ -37,23 +43,13 @@ jobs: - name: Install dependencies run: npm ci - - name: Lint - run: npm run lint - - - name: Type check - run: npm run typecheck - - - name: Unit tests - run: npm run unit-test - - name: Update version in package.json run: | npm version ${{ steps.gitversion.outputs.semVer }} --no-git-tag-version - name: Package extension run: | - npm install -g @vscode/vsce - vsce package --no-git-tag-version -o alcops-${{ steps.gitversion.outputs.semVer }}.vsix + npx vsce package --no-git-tag-version -o alcops-${{ steps.gitversion.outputs.semVer }}.vsix - name: Create GitHub Release uses: softprops/action-gh-release@v2 @@ -69,4 +65,4 @@ jobs: - name: Publish to VS Code Marketplace if: startsWith(github.ref, 'refs/tags/v') run: | - vsce publish -p ${{ secrets.VISUAL_STUDIO_MARKETPLACE_PAT }} --packagePath ./alcops-${{ steps.gitversion.outputs.semVer }}.vsix \ No newline at end of file + npx vsce publish -p ${{ secrets.VISUAL_STUDIO_MARKETPLACE_PAT }} --packagePath ./alcops-${{ steps.gitversion.outputs.semVer }}.vsix \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/build-test.yml similarity index 52% rename from .github/workflows/ci.yml rename to .github/workflows/build-test.yml index 2a36a31..f7aba43 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/build-test.yml @@ -1,13 +1,18 @@ -name: CI +name: Build and Test on: - pull_request: - branches: - - main - - "release/**" + workflow_call: + inputs: + draft-check: + description: "Whether to check if PR is draft" + required: false + type: boolean + default: true + workflow_dispatch: jobs: - ci: + build-and-test: + if: ${{ !inputs.draft-check || github.event.pull_request.draft == false }} runs-on: ubuntu-latest steps: - name: Checkout code @@ -29,3 +34,6 @@ jobs: - name: Unit tests run: npm run unit-test + + - name: Package validation + run: npx vsce package --no-git-tag-version diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 0000000..2334c75 --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,16 @@ +name: Pull Request + +on: + pull_request: + branches: + - main + - "release/**" + +permissions: + contents: read + +jobs: + build-and-test: + uses: ./.github/workflows/build-test.yml + with: + draft-check: true diff --git a/CHANGELOG.md b/CHANGELOG.md index facebb1..8720035 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,16 @@ All notable changes to the ALCops extension will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Fixed +- Update `engines.vscode` from `^1.110.0` to `^1.116.0` to match `@types/vscode`, fixing `vsce package` build failure + +### Changed +- Restructure CI into DRY pattern: extract shared `build-test.yml` reusable workflow, rename `ci.yml` to `pull-request.yml`, and have `build-and-release.yml` reuse `build-test.yml` (matching `ALCops/Analyzers` repo pattern) +- Add `vsce package` validation step to CI to catch `@types/vscode` vs `engines.vscode` mismatches on pull requests before merge +- Use `npx vsce` instead of global `npm install -g @vscode/vsce` in build-and-release workflow + ## [1.3.0] - 2026-04-17 ### Added diff --git a/package.json b/package.json index 8db3e35..9493661 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "code-quality" ], "engines": { - "vscode": "^1.110.0" + "vscode": "^1.116.0" }, "categories": [ "Linters"