Skip to content

Commit cb471c5

Browse files
committed
ci: Rework CI to use repository dispatch. Add dependents workflow
1 parent 088ac85 commit cb471c5

File tree

4 files changed

+107
-39
lines changed

4 files changed

+107
-39
lines changed

.github/workflows/dependents.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Dependents
2+
on:
3+
repository_dispatch:
4+
types: [ publish-complete ]
5+
6+
jobs:
7+
version:
8+
runs-on: ubuntu-latest
9+
outputs:
10+
version: ${{ steps.version.outputs.version }}
11+
steps:
12+
- uses: actions/checkout@v2
13+
- id: version
14+
run: |
15+
VERSION=$(grep '"version":' package.json -m1 | cut -d\" -f4)
16+
echo ::set-output name=version::${VERSION}
17+
18+
VisualPinball-Unity-Project-Hdrp:
19+
runs-on: ubuntu-latest
20+
needs: [ version ]
21+
steps:
22+
- name: Checkout VisualPinball.Unity.Project.Hdrp
23+
uses: actions/checkout@v2
24+
with:
25+
repository: VisualPinball/VisualPinball.Unity.Project.Hdrp
26+
token: ${{ secrets.GH_PAT }}
27+
- name: Commit
28+
run: |
29+
cd Packages
30+
jq '.dependencies."org.visualpinball.engine.unity.hdrp" = "${{ needs.version.outputs.version }}"' manifest.json > manifest.json.tmp
31+
mv manifest.json.tmp manifest.json
32+
git config user.name "github-actions"
33+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
34+
git add manifest.json
35+
git commit -m "chore(deps): Update org.visualpinball.engine.unity.hdrp to ${{ needs.version.outputs.version }}."
36+
git push

.github/workflows/publish.yml

Lines changed: 13 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,27 @@
1-
on: [push, pull_request]
1+
name: Publish
2+
on:
3+
repository_dispatch:
4+
types: [ release-complete ]
25

36
jobs:
47
publish:
58
runs-on: ubuntu-latest
6-
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
79
steps:
810
- uses: actions/checkout@v2
9-
with:
10-
fetch-depth: 0
11-
lfs: true
12-
- name: Fetch next version
13-
id: nextVersion
14-
uses: VisualPinball/[email protected]
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 ::set-output name=commitish::${commitish}
38-
env:
39-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40-
- name: Create Release
41-
uses: actions/create-release@v1
17+
18+
dispatch:
19+
runs-on: ubuntu-latest
20+
needs: [ publish ]
21+
steps:
22+
- uses: peter-evans/repository-dispatch@v1
4223
with:
43-
tag_name: ${{ steps.nextVersion.outputs.nextTag }}
44-
release_name: ${{ steps.nextVersion.outputs.nextTag }}
45-
prerelease: ${{ steps.nextVersion.outputs.isPrerelease }}
46-
commitish: ${{ steps.commit.outputs.commitish }}
47-
env:
48-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
token: ${{ secrets.GH_PAT }}
25+
event-type: publish-complete
26+
client-payload: '{"artifacts_run_id": "${{ github.run_id }}"}'
4927

.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.Hdrp' && 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 }}"}'

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
"Unity",
88
"HDRP"
99
],
10-
"unity": "2020.2",
11-
"unityRelease": "0f1",
10+
"unity": "2020.3",
11+
"unityRelease": "12f1",
1212
"dependencies": {
13-
"com.unity.render-pipelines.high-definition": "10.2.2",
14-
"com.unity.render-pipelines.high-definition-config": "10.2.2",
13+
"com.unity.render-pipelines.high-definition": "10.5.0",
14+
"com.unity.render-pipelines.high-definition-config": "10.5.0",
1515
"org.visualpinball.engine.unity": "0.0.1-preview.51",
1616
"org.visualpinball.unity.assetlibrary": "0.0.1-preview.16"
1717
},

0 commit comments

Comments
 (0)