Skip to content

Commit 418dd76

Browse files
authored
chore: refactor release workflow (#94)
Refactors the release and publish workflows to schedule a daily release, including automatic version bumping using `npx commit-and-tag-version`. The release can also be manually dispatched. Additionally, removes the makefile in favor of in-lining the scripts (less maintenance burden), and updates the docs. Finally, splits the pull request checks into fine-tuned jobs.
1 parent 010f098 commit 418dd76

5 files changed

Lines changed: 172 additions & 76 deletions

File tree

.github/workflows/build.yml

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,25 @@ permissions:
88
contents: read
99

1010
jobs:
11+
format:
12+
name: Format
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v5
18+
19+
- name: Setup Node
20+
uses: actions/setup-node@v4
21+
with:
22+
cache: npm
23+
24+
- name: Install dependencies
25+
run: npm ci
26+
27+
- name: Lint
28+
run: npx biome ci .
29+
1130
lint:
1231
name: Lint
1332
runs-on: ubuntu-latest
@@ -25,10 +44,10 @@ jobs:
2544
run: npm ci
2645

2746
- name: Lint
28-
run: make lint
47+
run: npx eslint
2948

30-
test:
31-
name: Test
49+
type-check:
50+
name: Type Check
3251
runs-on: ubuntu-latest
3352

3453
steps:
@@ -46,6 +65,22 @@ jobs:
4665
- name: Type check
4766
run: npx tsc
4867

68+
test:
69+
name: Test
70+
runs-on: ubuntu-latest
71+
72+
steps:
73+
- name: Checkout
74+
uses: actions/checkout@v5
75+
76+
- name: Setup Node
77+
uses: actions/setup-node@v4
78+
with:
79+
cache: npm
80+
81+
- name: Install dependencies
82+
run: npm ci
83+
4984
- name: Compile
5085
run: npx vsce package
5186
env:

.github/workflows/publish.yml

Lines changed: 78 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
1-
name: Publish Extension
1+
name: Publish
22

33
on:
4-
workflow_dispatch:
5-
inputs:
6-
publish_vscode_marketplace:
7-
description: 'Publish to VS Marketplace'
8-
type: boolean
9-
default: true
10-
publish_ovsx:
11-
description: 'Publish to Open VSX'
12-
type: boolean
13-
default: true
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
concurrency:
9+
group: publish
10+
cancel-in-progress: false
1411

1512
permissions:
16-
contents: read
13+
contents: write
1714

1815
jobs:
19-
publish-vscode-marketplace:
20-
name: Publish to VS Marketplace
16+
test:
17+
name: Test
2118
runs-on: ubuntu-latest
22-
if: ${{ inputs.publish_vscode_marketplace != false }}
2319

2420
steps:
2521
- name: Checkout
@@ -33,22 +29,21 @@ jobs:
3329
- name: Install dependencies
3430
run: npm ci
3531

36-
- name: Set version from branch name
37-
uses: ./.github/actions/set-version
38-
39-
- name: Publish to VS Marketplace
40-
run: make publish-marketplace
32+
- name: Compile
33+
run: npx vsce package
4134
env:
42-
VERSION: ${{ env.VERSION }}
43-
VSCE_PAT: ${{ secrets.VSCE_PAT }}
4435
LOCALSTACK_WEB_AUTH_REDIRECT: https://app.localstack.cloud/redirect
45-
NODE_ENV: production
46-
ANALYTICS_API_URL: https://analytics.localstack.cloud/v1/events
36+
NODE_ENV: ci
4737

48-
publish-ovsx:
49-
name: Publish to Open VSX
38+
- name: Test
39+
run: xvfb-run -a npx vscode-test
40+
41+
build:
42+
name: Build
5043
runs-on: ubuntu-latest
51-
if: ${{ inputs.publish_ovsx != false }}
44+
needs: test
45+
outputs:
46+
version: ${{ steps.version.outputs.version }}
5247

5348
steps:
5449
- name: Checkout
@@ -62,14 +57,64 @@ jobs:
6257
- name: Install dependencies
6358
run: npm ci
6459

65-
- name: Set version from branch name
66-
uses: ./.github/actions/set-version
60+
- name: Get version from tag
61+
id: version
62+
run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
6763

68-
- name: Publish to Open VSX
69-
run: make publish-ovsx
64+
- name: Build VSIX
65+
run: npx vsce package
7066
env:
71-
VERSION: ${{ env.VERSION }}
72-
OVSX_PAT: ${{ secrets.OVSX_PAT }}
7367
LOCALSTACK_WEB_AUTH_REDIRECT: https://app.localstack.cloud/redirect
7468
NODE_ENV: production
7569
ANALYTICS_API_URL: https://analytics.localstack.cloud/v1/events
70+
71+
- name: Upload VSIX artifact
72+
uses: actions/upload-artifact@v4
73+
with:
74+
name: vsix
75+
path: "*.vsix"
76+
77+
- name: Create GitHub Release
78+
uses: softprops/action-gh-release@v2
79+
with:
80+
tag_name: ${{ github.ref_name }}
81+
generate_release_notes: true
82+
files: "*.vsix"
83+
84+
publish-vscode-marketplace:
85+
name: Publish to VS Marketplace
86+
runs-on: ubuntu-latest
87+
needs: build
88+
89+
steps:
90+
- name: Download VSIX
91+
uses: actions/download-artifact@v4
92+
with:
93+
name: vsix
94+
95+
- name: Setup Node
96+
uses: actions/setup-node@v4
97+
98+
- name: Publish to VS Marketplace
99+
run: npx @vscode/vsce publish --packagePath localstack-${{ needs.build.outputs.version }}.vsix
100+
env:
101+
VSCE_PAT: ${{ secrets.VSCE_PAT }}
102+
103+
publish-ovsx:
104+
name: Publish to Open VSX
105+
runs-on: ubuntu-latest
106+
needs: build
107+
108+
steps:
109+
- name: Download VSIX
110+
uses: actions/download-artifact@v4
111+
with:
112+
name: vsix
113+
114+
- name: Setup Node
115+
uses: actions/setup-node@v4
116+
117+
- name: Publish to Open VSX
118+
run: npx ovsx publish localstack-${{ needs.build.outputs.version }}.vsix -p $OVSX_PAT
119+
env:
120+
OVSX_PAT: ${{ secrets.OVSX_PAT }}

.github/workflows/release.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Release
2+
3+
on:
4+
schedule:
5+
- cron: '0 8 * * 1' # Every Monday at 08:00 UTC
6+
workflow_dispatch:
7+
8+
concurrency:
9+
group: release
10+
cancel-in-progress: false
11+
12+
permissions:
13+
contents: write
14+
15+
jobs:
16+
release:
17+
name: Release
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v5
23+
with:
24+
fetch-depth: 0
25+
token: ${{ secrets.GITHUB_TOKEN }}
26+
27+
- name: Setup Node
28+
uses: actions/setup-node@v4
29+
with:
30+
cache: npm
31+
32+
- name: Install dependencies
33+
run: npm ci
34+
35+
- name: Configure git
36+
run: |
37+
git config user.name "github-actions[bot]"
38+
git config user.email "github-actions[bot]@users.noreply.github.com"
39+
40+
- name: Bump version, update changelog, and tag
41+
run: |
42+
BEFORE=$(node -p "require('./package.json').version")
43+
npx --yes commit-and-tag-version
44+
AFTER=$(node -p "require('./package.json').version")
45+
46+
if [ "$BEFORE" != "$AFTER" ]; then
47+
git push --follow-tags origin main
48+
else
49+
echo "No releasable commits — skipping push"
50+
fi

CONTRIBUTING.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ To update the extension after making code changes, you need to regenerate the VS
2626
Run the following command in your project directory:
2727

2828
```sh
29-
make vsix
29+
npx vsce package
3030
```
3131

3232
This will build a new `.vsix` file in the directory (localstack-x.x.1.vsix).
@@ -43,13 +43,10 @@ To install the generated VSIX file in Visual Studio Code:
4343
3. Select **Install from VSIX...**.
4444
4. Choose the `.vsix` file.
4545

46-
## Releasing a new version
46+
## Releasing and publishing
4747

48-
To release a new version of the extension, you need to:
48+
Releasing and publishing is controlled by workflows.
4949

50-
1. Create a branch using the new version as the name (e.g. `v1.3.0`)
51-
2. Update the version in `package.json` and run `npm install`
52-
3. Update the `CHANGELOG.md` file
53-
4. Push the branch to GitHub
54-
5. Create a pull request in GitHub
55-
6. While the pull request is open, execute the `Publish Extension` workflow targetting the new branch
50+
The release workflow will run once a day, bump the version automatically and push the corresponding git version tag. If necessary, it can be triggered manually.
51+
52+
The publish workflow will run for every git version tag, and will generate a GitHub release and publish the extension to the VS Marketplace and the Open VSX Registry.

Makefile

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)