Skip to content

Commit deb8813

Browse files
simonmikaCopilot
andauthored
Publish before bump (#19)
* Switched to publish before version bump. Co-authored-by: Copilot <copilot@github.com> * Fixed version naming convention. --------- Co-authored-by: Copilot <copilot@github.com>
1 parent 8cad1fc commit deb8813

6 files changed

Lines changed: 54 additions & 119 deletions

File tree

.github/workflows/bump-alpha.yml

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

.github/workflows/bump-beta.yml

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

.github/workflows/bump-common.yml

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

.github/workflows/bump.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: "Bump"
2+
3+
on:
4+
workflow_run:
5+
workflows:
6+
- "Publish"
7+
types:
8+
- completed
9+
branches:
10+
- "master"
11+
- "master-2"
12+
- "master-beta"
13+
14+
concurrency:
15+
group: bump-${{ github.event.workflow_run.head_branch }}
16+
cancel-in-progress: false
17+
18+
jobs:
19+
bump:
20+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
21+
name: "Bump Version"
22+
timeout-minutes: 60
23+
runs-on: ubuntu-latest
24+
permissions:
25+
contents: write
26+
steps:
27+
- name: "Checkout source code"
28+
uses: actions/checkout@v4
29+
with:
30+
ref: ${{ github.event.workflow_run.head_branch }}
31+
fetch-depth: 0
32+
token: ${{ github.token }}
33+
34+
- name: "Bump version"
35+
uses: phips28/gh-action-bump-version@v11.0.7
36+
env:
37+
GITHUB_TOKEN: ${{ github.token }}
38+
with:
39+
default: "${{ (github.event.workflow_run.head_branch == 'master-2' || github.event.workflow_run.head_branch == 'master-beta') && 'prerelease' || 'minor' }}"
40+
preid: "${{ github.event.workflow_run.head_branch == 'master-2' && 'alpha' || (github.event.workflow_run.head_branch == 'master-beta' && 'beta' || '') }}"
41+
tag-prefix: "release-"
42+
bump-policy: last-commit
43+
check-last-commit-only: true
44+
target-branch: ${{ github.event.workflow_run.head_branch }}
45+
commit-message: "ci: version bump to {{version}} [skip ci]"

.github/workflows/publish.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
name: "Publish"
22

33
on:
4-
workflow_run:
5-
workflows:
6-
- "Bump Alpha"
7-
- "Bump Minor"
8-
types:
9-
- completed
4+
push:
5+
branches:
6+
- "master"
7+
- "master-2"
8+
- "master-beta"
109

1110
concurrency:
12-
group: publish-${{ github.event.workflow_run.head_branch }}
11+
group: publish-${{ github.ref_name }}
1312
cancel-in-progress: false
1413

1514
permissions:
@@ -19,19 +18,18 @@ permissions:
1918
jobs:
2019
publish:
2120
name: "Publish"
22-
if: ${{ github.event.workflow_run.conclusion == 'success' }}
2321
timeout-minutes: 60
2422
runs-on: ubuntu-latest
2523

2624
steps:
2725
- uses: actions/checkout@v4
2826
with:
29-
ref: ${{ github.event.workflow_run.head_sha }}
27+
ref: ${{ github.sha }}
3028
- uses: actions/setup-node@v4
3129
with:
3230
node-version: 22
3331
cache: "npm"
3432
registry-url: "https://registry.npmjs.org"
3533
- run: npm ci
3634
- run: npm run build
37-
- run: npm publish --tag "${{ github.event.workflow_run.name == 'Bump Minor' && 'latest' || (github.event.workflow_run.name == 'Bump Alpha' && 'alpha' || 'beta') }}" --access public --provenance
35+
- run: npm publish --tag "${{ github.ref_name == 'master-2' && 'alpha' || (github.ref_name == 'master-beta' && 'beta' || 'latest') }}" --access public --provenance

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
}
2929
},
3030
"git": {
31-
"tagName": "v${version}"
31+
"tagName": "release-${version}"
3232
},
3333
"github": {
3434
"release": true

0 commit comments

Comments
 (0)