66 - main
77
88jobs :
9- release :
9+ test-and-bump :
1010 runs-on : ubuntu-latest
11- if : ${{ !contains(github.event.head_commit.message, '[skip ci] ') }}
11+ if : ${{ !contains(github.event.head_commit.message, 'release/v ') }}
1212
1313 permissions :
1414 contents : write
15+ pull-requests : write
1516
1617 steps :
1718 - uses : actions/checkout@v4
1819 - uses : actions/setup-node@v4
1920 with :
2021 node-version : 20
2122
22- - name : Install the dependencies
23+ - name : Install dependencies
2324 run : npm ci
2425
2526 - name : Run tests
@@ -30,12 +31,45 @@ jobs:
3031 git config user.name "github-actions[bot]"
3132 git config user.email "github-actions[bot]@users.noreply.github.com"
3233
33- - name : Bump version
34+ - name : Bump version and create release PR
3435 run : |
35- npm version patch -m "chore: release v%s [skip ci]"
36+ npm version patch --no-git-tag-version
37+ VERSION=$(node -p "require('./package.json').version")
38+ BRANCH="release/v${VERSION}"
39+ git checkout -b "$BRANCH"
40+ git add package.json package-lock.json
41+ git commit -m "chore: release v${VERSION}"
42+ git push origin "$BRANCH"
43+ gh pr create --title "chore: release v${VERSION}" --body "Automated version bump to v${VERSION}"
44+ env :
45+ GH_TOKEN : ${{ github.token }}
46+
47+ publish :
48+ runs-on : ubuntu-latest
49+ if : ${{ contains(github.event.head_commit.message, 'release/v') }}
50+
51+ permissions :
52+ contents : write
53+
54+ steps :
55+ - uses : actions/checkout@v4
56+ - uses : actions/setup-node@v4
57+ with :
58+ node-version : 20
59+
60+ - name : Install dependencies
61+ run : npm ci
62+
63+ - name : Configure git
64+ run : |
65+ git config user.name "github-actions[bot]"
66+ git config user.email "github-actions[bot]@users.noreply.github.com"
3667
37- - name : Push version bump and tag
38- run : git push origin main --follow-tags
68+ - name : Create and push tag
69+ run : |
70+ VERSION=$(node -p "require('./package.json').version")
71+ git tag "v${VERSION}"
72+ git push origin "v${VERSION}"
3973
4074 - name : Install vsce
4175 run : npm i -g @vscode/vsce
0 commit comments