Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/AUTOMATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,20 @@
This repository uses reusable actions pinned to
`ziqq/actions@ccd1a799683cd461a45d9303ac6fcb2792f8f5d2`.

## Extension validation and publication

Pull request CI packages the extension as a VSIX using Node.js 22 and
`@vscode/vsce@4.0.0`. The package currently has no test or lint npm scripts.

Publication runs only when an existing version tag is pushed. The tag must be
`v<package.json version>`, and the first version in `CHANGELOG.md` must match.
The workflow does not create tags or change the package version.

The deploy job uses the `release` environment and the existing `VSCE_PAT` secret.
Before the next release, configure the environment with a required reviewer and
a tag-only `v*` deployment policy, then protect the release tags. Keep the
repository secrets until a separate credential migration is approved.

## Semantic labels

`.github/labels.json` is the repository-owned source of truth. Automation uses
Expand Down
28 changes: 13 additions & 15 deletions .github/workflows/checkout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ on:
- "**.js"
- "**.mjs"

permissions:
contents: read

jobs:
checkout:
name: "Checkout VS Code Extension"
Expand All @@ -39,7 +42,9 @@ jobs:
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
persist-credentials: false
#with:
# sparse-checkout: |
# .github
Expand All @@ -51,24 +56,17 @@ jobs:
# CHANGELOG.md

- name: Install Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 18.x
node-version: 22.x

- name: Install Dependencies
run: npm install

- name: Run Tests
run: xvfb-run -a npm test
if: runner.os == 'Linux'

- name: Run Tests
run: npm test
if: runner.os != 'Linux'

- name: Lint Code
run: |
npm run lint
npm ci
npm install -g @vscode/vsce@4.0.0

- name: Package extension
run: vsce package --out "$RUNNER_TEMP/codepen-theme.vsix"

notify:
name: Notify CI result
Expand Down
32 changes: 27 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,52 @@ on:
# types:
# - created

permissions:
contents: read

jobs:
deploy:
name: "Deploy VS Code Extension"
runs-on: ubuntu-latest
environment: release
defaults:
run:
working-directory: ./
timeout-minutes: 15
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
persist-credentials: false

- name: Install Node.js
id: node-setup
uses: actions/setup-node@v4
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 20.x
node-version: 22.x

- name: Validate release tag
run: |
node <<'NODE'
const fs = require('node:fs');
const { version } = JSON.parse(fs.readFileSync('package.json', 'utf8'));
const changelog = fs.readFileSync('CHANGELOG.md', 'utf8');
const changelogVersion = changelog.match(/^##\s+(\S+)/m)?.[1];
if (process.env.GITHUB_REF_TYPE !== 'tag' ||
process.env.GITHUB_REF_NAME !== `v${version}` ||
changelogVersion !== version) {
console.error('The release tag, package.json and first changelog version must match.');
process.exit(1);
}
console.log(`Validated existing release tag v${version}.`);
NODE

- name: Install Dependencies
id: install
run: |
npm install
npm install -g @vscode/vsce
npm ci
npm install -g @vscode/vsce@4.0.0

- name: Publish
id: publish
Expand Down
Loading