Skip to content

Commit 3737d09

Browse files
committed
feat(ci): remove old workflows and add new release process
1 parent 66d746c commit 3737d09

File tree

4 files changed

+144
-36
lines changed

4 files changed

+144
-36
lines changed

.github/workflows/bump.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Version Bump
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
7+
jobs:
8+
version-bump:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
token: ${{ secrets.GITHUB_TOKEN }}
17+
18+
- name: Bump version
19+
id: bump-version
20+
uses: phips28/gh-action-bump-version@master
21+
with:
22+
tag-prefix: 'v'
23+
major-wording: '[major]'
24+
minor-wording: '[minor]'
25+
patch-wording: '[patch]'
26+
skip-tag: true
27+
skip-commit: true
28+
skip-push: true
29+
30+
- name: Create Pull Request
31+
if: steps.bump-version.outputs.newTag != ''
32+
uses: peter-evans/create-pull-request@v6
33+
with:
34+
token: ${{ secrets.GITHUB_TOKEN }}
35+
branch: release/${{ steps.bump-version.outputs.newTag }}
36+
base: main
37+
title: "Release ${{ steps.bump-version.outputs.newTag }}"
38+
body: |
39+
## Release ${{ steps.bump-version.outputs.newTag }}
40+
41+
This PR contains the version bump for the next release.
42+
43+
**Changes:**
44+
- Bump version to ${{ steps.bump-version.outputs.newTag }}
45+
46+
**Next steps:**
47+
- Review and merge this PR
48+
- The release workflow will automatically create a tag, GitHub release, and publish the extension
49+
commit-message: "chore: bump version to ${{ steps.bump-version.outputs.newTag }}"
50+
delete-branch: true

.github/workflows/publish.yml

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

.github/workflows/release.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
workflow_dispatch:
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
12+
# Only run if this is a merge commit (PR merge) and contains version bump
13+
if: contains(github.event.head_commit.message, 'chore: bump version to v')
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Extract version from commit message
22+
id: extract-version
23+
uses: actions-ecosystem/action-regex-match@v2
24+
with:
25+
text: ${{ github.event.head_commit.message }}
26+
regex: 'chore: bump version to v([\d.]+)'
27+
flags: gm
28+
29+
- name: Setup Node.js
30+
uses: actions/setup-node@v4
31+
with:
32+
node-version: '22.x'
33+
34+
- name: Setup pnpm
35+
uses: pnpm/action-setup@v4
36+
37+
- name: Get pnpm store directory
38+
shell: bash
39+
run: |
40+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
41+
42+
- name: Setup pnpm cache
43+
uses: actions/cache@v4
44+
with:
45+
path: ${{ env.STORE_PATH }}
46+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
47+
restore-keys: |
48+
${{ runner.os }}-pnpm-store-
49+
50+
- name: Install dependencies
51+
run: pnpm install --frozen-lockfile
52+
53+
- name: Run tests
54+
run: xvfb-run -a pnpm test
55+
env:
56+
CI: true
57+
58+
- name: Build extension
59+
run: pnpm run build
60+
61+
- name: Create Tag
62+
uses: mathieudutour/github-tag-action@v6.1
63+
with:
64+
custom_tag: v${{ steps.extract-version.outputs.group1 }}
65+
github_token: ${{ secrets.GITHUB_TOKEN }}
66+
tag_prefix: ''
67+
tag_message: 'Release v${{ steps.extract-version.outputs.group1 }}'
68+
69+
- name: Create GitHub Release
70+
uses: softprops/action-gh-release@v2
71+
with:
72+
tag_name: v${{ steps.extract-version.outputs.group1 }}
73+
name: Release v${{ steps.extract-version.outputs.group1 }}
74+
body: |
75+
## Release v${{ steps.extract-version.outputs.group1 }}
76+
77+
Automated release created from version bump commit.
78+
79+
**Installation:**
80+
- Download the `.vsix` file from the assets below
81+
- Install via VS Code: `code --install-extension vscode-generic-expand-selection-${{ steps.extract-version.outputs.group1 }}.vsix`
82+
- Or install from VS Code Extensions marketplace
83+
files: |
84+
out.vsix
85+
draft: false
86+
prerelease: false
87+
88+
- name: Publish to VS Code Marketplace
89+
uses: HaaLeo/publish-vscode-extension@v1
90+
with:
91+
pat: ${{ secrets.VSCE_PAT }}
92+
registryUrl: https://marketplace.visualstudio.com
93+
extensionFile: out.vsix

.github/workflows/test.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: Test
22

33
on:
4-
push:
5-
branches: [ main ]
64
pull_request:
75
branches: [ main ]
86

@@ -51,4 +49,4 @@ jobs:
5149
CI: true
5250

5351
- name: Build extension
54-
run: pnpm run package
52+
run: pnpm run build

0 commit comments

Comments
 (0)