Skip to content

Commit 56d395f

Browse files
authored
ci: add release job (#179)
1 parent f4c0635 commit 56d395f

5 files changed

Lines changed: 64 additions & 5 deletions

File tree

.github/dependabot.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ updates:
1313
patterns:
1414
- '@vscode/vsce'
1515
- '@secretlint/*'
16+
cooldown:
17+
default-days: 7
1618
- package-ecosystem: github-actions
1719
directory: /
1820
schedule:
1921
interval: weekly
22+
cooldown:
23+
default-days: 7

.github/workflows/check-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ jobs:
1515
title:
1616
runs-on: ubuntu-latest
1717
steps:
18-
- uses: amannn/action-semantic-pull-request@v6
18+
- uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1
1919
env:
2020
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/ci.yml

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
name: CI
2+
23
on:
4+
release:
35
push:
46
branches: [main]
57
pull_request:
68
branches: [main]
9+
10+
permissions:
11+
contents: read
12+
713
jobs:
814
test:
915
name: Node.js ${{ matrix.node-version }}
@@ -14,22 +20,59 @@ jobs:
1420
node-version:
1521
- '24'
1622
steps:
17-
- uses: actions/checkout@v6
23+
- name: Clone repository
24+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
25+
with:
26+
persist-credentials: false
27+
- name: Check GH actions
28+
uses: zizmorcore/zizmor-action@b1d7e1fb5de872772f31590499237e7cce841e8e # v0.5.3
1829
- run: corepack enable
19-
- uses: actions/setup-node@v6
30+
- name: Install Node.js
31+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
2032
with:
2133
node-version: ${{ matrix.node-version }}
2234
cache: yarn
2335
- run: yarn install --immutable
2436
- run: yarn lint
2537
- run: xvfb-run -a yarn test
2638
- run: yarn vsce-package
39+
- name: Validate package version matches git tag
40+
if: github.event_name == 'release'
41+
run: |
42+
PACKAGE_VERSION=$(jq -r .version package.json)
43+
if [ "$GITHUB_REF_NAME" != "v$PACKAGE_VERSION" ]; then
44+
echo "Error: Tag version ($TAG_VERSION) does not match package.json version (v$PACKAGE_VERSION)"
45+
exit 1
46+
fi
47+
- name: Upload VSIX
48+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
49+
if: github.event_name == 'release'
50+
with:
51+
name: vsix
52+
path: '*.vsix'
53+
release:
54+
if: github.event_name == 'release'
55+
needs:
56+
- test
57+
name: Release
58+
runs-on: ubuntu-latest
59+
steps:
60+
- name: Download VSIX
61+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
62+
with:
63+
name: vsix
64+
- name: Install Node.js
65+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
66+
with:
67+
node-version: 'lts/*'
68+
- run: gh release upload "$GITHUB_REF_NAME" *.vsix
69+
- run: npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} -i *.vsix
2770
check:
2871
if: always()
2972
needs:
3073
- test
3174
runs-on: ubuntu-latest
3275
steps:
33-
- uses: re-actors/alls-green@release/v1
76+
- uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
3477
with:
3578
jobs: ${{ toJSON(needs) }}

CONTRIBUTING.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,15 @@ The scripts in `packagage.json` are used to manage this project.
2121
- replace `assets/hatch-logo.woff2`
2222

2323
(The logo.png is a copy of the regular Hatch logo, resized to 128px.)
24+
25+
## CI/CD tokens
26+
27+
To update the `MARKETPLACE_TOKEN` secret,
28+
we can follow the [“publishing extensions” tutorial](https://code.visualstudio.com/api/working-with-extensions/publishing-extension).
29+
30+
Azure is weird, so in order to create an organization-independent PAT to publish extensions to the marketplace,
31+
one still needs access to an organization.
32+
33+
I personally have access to the `scverse` org so I’ll use that:
34+
[token settings](https://dev.azure.com/scverse/_usersSettings/tokens) (Select “Access scope: **All accessible organizations**” in the filter list)
35+

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "hatch",
33
"displayName": "Hatch",
44
"description": "Manage Hatch environments",
5-
"version": "0.1.1",
5+
"version": "0.1.2",
66
"license": "GPL-3.0",
77
"type": "module",
88
"engines": {

0 commit comments

Comments
 (0)