Skip to content

Commit cfd3d87

Browse files
authored
Merge pull request #45 from Cysharp/release
ci: Improve consistency for nuget publish
2 parents 6491c8a + 39e659f commit cfd3d87

1 file changed

Lines changed: 22 additions & 12 deletions

File tree

‎.github/workflows/build-release.yaml‎

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,31 @@ on:
1212
default: false
1313
type: boolean
1414

15+
concurrency:
16+
group: release
17+
cancel-in-progress: false
18+
1519
jobs:
20+
validate-release:
21+
permissions:
22+
contents: read
23+
uses: Cysharp/Actions/.github/workflows/validate-release.yaml@main
24+
with:
25+
tag: ${{ inputs.tag }}
26+
1627
update-packagejson:
28+
needs: [validate-release]
1729
permissions:
1830
actions: read
1931
contents: write
2032
uses: Cysharp/Actions/.github/workflows/update-packagejson.yaml@main
2133
with:
2234
file-path: ./RuntimeUnitTestToolkit/Assets/RuntimeUnitTestToolkit/package.json
23-
tag: ${{ inputs.tag }}
35+
tag: ${{ needs.validate-release.outputs.tag }}
2436
dry-run: ${{ inputs.dry-run }}
2537

2638
build-unity:
27-
needs: [update-packagejson]
39+
needs: [validate-release, update-packagejson]
2840
strategy:
2941
matrix:
3042
unity: ["2022.3.39f1"]
@@ -55,7 +67,7 @@ jobs:
5567
UNITY_EMAIL: ${{ steps.op-load-secret.outputs.UNITY_EMAIL }}
5668
UNITY_PASSWORD: ${{ steps.op-load-secret.outputs.UNITY_PASSWORD }}
5769
UNITY_SERIAL: ${{ steps.op-load-secret.outputs.UNITY_SERIAL }}
58-
UNITY_PACKAGE_VERSION: ${{ inputs.tag }}
70+
UNITY_PACKAGE_VERSION: ${{ needs.validate-release.outputs.tag }}
5971
with:
6072
projectPath: RuntimeUnitTestToolkit
6173
unityVersion: ${{ matrix.unity }}
@@ -69,29 +81,27 @@ jobs:
6981
# Store artifacts.
7082
- uses: Cysharp/Actions/.github/actions/upload-artifact@main
7183
with:
72-
name: RuntimeUnitTestToolkit.${{ inputs.tag }}.unitypackage
73-
path: ./RuntimeUnitTestToolkit/RuntimeUnitTestToolkit.${{ inputs.tag }}.unitypackage
84+
name: RuntimeUnitTestToolkit.${{ needs.validate-release.outputs.tag }}.unitypackage
85+
path: ./RuntimeUnitTestToolkit/RuntimeUnitTestToolkit.${{ needs.validate-release.outputs.tag }}.unitypackage
7486
retention-days: 1
7587

7688
# release
7789
create-release:
78-
needs: [update-packagejson, build-unity]
90+
needs: [validate-release, update-packagejson, build-unity]
7991
permissions:
8092
contents: write
81-
id-token: write
8293
uses: Cysharp/Actions/.github/workflows/create-release.yaml@main
8394
with:
8495
commit-id: ${{ needs.update-packagejson.outputs.sha }}
8596
dry-run: ${{ inputs.dry-run }}
86-
tag: ${{ inputs.tag }}
87-
nuget-push: false
97+
tag: ${{ needs.validate-release.outputs.tag }}
8898
release-upload: true
89-
release-asset-path: ./RuntimeUnitTestToolkit.${{ inputs.tag }}.unitypackage
99+
release-asset-path: ./RuntimeUnitTestToolkit.${{ needs.validate-release.outputs.tag }}.unitypackage
90100
secrets: inherit
91101

92102
cleanup:
93-
if: ${{ needs.update-packagejson.outputs.is-branch-created == 'true' }}
94-
needs: [update-packagejson, build-unity]
103+
if: ${{ always() && needs.update-packagejson.outputs.is-branch-created == 'true' }}
104+
needs: [update-packagejson, create-release]
95105
permissions:
96106
contents: write
97107
uses: Cysharp/Actions/.github/workflows/clean-packagejson-branch.yaml@main

0 commit comments

Comments
 (0)