Skip to content

Commit 1ba1dc1

Browse files
Split CI into publish and release workflows
1 parent 111b2b0 commit 1ba1dc1

File tree

2 files changed

+62
-34
lines changed

2 files changed

+62
-34
lines changed

.github/workflows/publish.yml

+11-34
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,25 @@
1-
on: [push, pull_request]
1+
on:
2+
repository_dispatch:
3+
types: [ release-complete ]
24

35
jobs:
46
publish:
57
runs-on: ubuntu-latest
68
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
79
steps:
810
- uses: actions/checkout@v4
9-
with:
10-
fetch-depth: 0
11-
lfs: true
12-
- name: Fetch next version
13-
id: nextVersion
14-
uses: VisualPinball/next-version-action@v0
15-
with:
16-
tagPrefix: 'v'
17-
- name: Bump
18-
if: ${{ steps.nextVersion.outputs.isBump == 'true' }}
19-
run: |
20-
npm version ${{ steps.nextVersion.outputs.nextVersion }} --no-git-tag-version
2111
- name: Publish
2212
run: |
2313
echo "//registry.visualpinball.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
2414
npm publish
2515
env:
2616
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
27-
- name: Commit
28-
id: commit
29-
if: ${{ steps.nextVersion.outputs.isBump == 'true' }}
30-
run: |
31-
git config user.name "github-actions"
32-
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
33-
git add package.json
34-
git commit -m "release: ${{ steps.nextVersion.outputs.nextTag }}."
35-
git push
36-
commitish=$(git rev-parse HEAD)
37-
echo "commitish=${commitish}" >> $GITHUB_OUTPUT
38-
env:
39-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40-
- name: Create Release
41-
uses: softprops/action-gh-release@v2
42-
with:
43-
tag_name: ${{ steps.nextVersion.outputs.nextTag }}
44-
name: ${{ steps.nextVersion.outputs.nextTag }}
45-
prerelease: ${{ steps.nextVersion.outputs.isPrerelease }}
46-
target_commitish: ${{ steps.commit.outputs.commitish }}
47-
token: ${{ secrets.GITHUB_TOKEN }}
4817

18+
dispatch:
19+
runs-on: ubuntu-latest
20+
needs: [ publish ]
21+
steps:
22+
- name: Repository Dispatch
23+
uses: peter-evans/repository-dispatch@v3
24+
with:
25+
event-type: publish-complete

.github/workflows/release.yml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
on: [push, pull_request]
2+
3+
jobs:
4+
release:
5+
runs-on: ubuntu-latest
6+
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
7+
steps:
8+
- uses: actions/checkout@v4
9+
with:
10+
fetch-depth: 0
11+
lfs: true
12+
- name: Fetch next version
13+
id: nextVersion
14+
uses: VisualPinball/next-version-action@v0
15+
with:
16+
tagPrefix: 'v'
17+
- name: Bump
18+
if: ${{ steps.nextVersion.outputs.isBump == 'true' }}
19+
run: |
20+
npm version ${{ steps.nextVersion.outputs.nextVersion }} --no-git-tag-version
21+
- name: Commit
22+
id: commit
23+
if: ${{ steps.nextVersion.outputs.isBump == 'true' }}
24+
run: |
25+
git config user.name "github-actions"
26+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
27+
git add package.json
28+
git commit -m "release: ${{ steps.nextVersion.outputs.nextTag }}."
29+
git push
30+
commitish=$(git rev-parse HEAD)
31+
echo "commitish=${commitish}" >> $GITHUB_OUTPUT
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
- name: Create Release
35+
uses: softprops/action-gh-release@v2
36+
with:
37+
tag_name: ${{ steps.nextVersion.outputs.nextTag }}
38+
name: ${{ steps.nextVersion.outputs.nextTag }}
39+
prerelease: ${{ steps.nextVersion.outputs.isPrerelease }}
40+
target_commitish: ${{ steps.commit.outputs.commitish }}
41+
token: ${{ secrets.GITHUB_TOKEN }}
42+
43+
dispatch:
44+
runs-on: ubuntu-latest
45+
needs: [ release ]
46+
steps:
47+
- name: Repository Dispatch
48+
uses: peter-evans/repository-dispatch@v3
49+
with:
50+
event-type: release-complete
51+

0 commit comments

Comments
 (0)