Skip to content

Commit 2d618ce

Browse files
jsm174freezy
authored andcommitted
ci: add release and publish workflows
1 parent 4637ceb commit 2d618ce

File tree

2 files changed

+81
-0
lines changed

2 files changed

+81
-0
lines changed

.github/workflows/publish.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Publish
2+
on:
3+
repository_dispatch:
4+
types: [ release-complete ]
5+
6+
jobs:
7+
publish:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
- name: Publish
12+
run: |
13+
echo "//registry.visualpinball.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
14+
npm publish
15+
env:
16+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
17+
18+
dispatch:
19+
runs-on: ubuntu-latest
20+
needs: [ publish ]
21+
steps:
22+
- uses: peter-evans/repository-dispatch@v1
23+
with:
24+
token: ${{ secrets.GH_PAT }}
25+
event-type: publish-complete
26+
client-payload: '{"artifacts_run_id": "${{ github.run_id }}"}'
27+

.github/workflows/release.yml

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

0 commit comments

Comments
 (0)