66 tag :
77 description : " tag: git tag you want create. (sample 1.0.0)"
88 required : true
9- dry_run :
10- description : " dry_run : true will never create relase/nuget."
9+ dry-run :
10+ description : " dry-run : true will never create relase/nuget."
1111 required : true
12- default : " false"
12+ default : false
13+ type : boolean
1314
1415env :
1516 GIT_TAG : ${{ github.event.inputs.tag }}
16- DRY_RUN : ${{ github.event.inputs.dry_run }}
17- DRY_RUN_BRANCH_PREFIX : " test_release"
17+ DRY_RUN : ${{ github.event.inputs.dry-run }}
1818
1919jobs :
2020 update-packagejson :
21- runs-on : ubuntu-latest
22- env :
23- TARGET_FILE : ./RuntimeUnitTestToolkit/Assets/RuntimeUnitTestToolkit/package.json
24- outputs :
25- sha : ${{ steps.commit.outputs.sha }}
26- steps :
27- - uses : actions/checkout@v2
28- - name : Output package.json (Before)
29- run : cat ${{ env.TARGET_FILE}}
30-
31- - name : Update package.json to version ${{ env.GIT_TAG }}
32- run : sed -i -e "s/\(\"version\":\) \"\(.*\)\",/\1 \"${{ env.GIT_TAG }}\",/" ${{ env.TARGET_FILE }}
33-
34- - name : Check update
35- id : check_update
36- run : |
37- cat ${{ env.TARGET_FILE}}
38- git diff --exit-code || echo "::set-output name=changed::1"
39-
40- - name : Commit files
41- id : commit
42- if : steps.check_update.outputs.changed == '1'
43- run : |
44- git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
45- git config --local user.name "github-actions[bot]"
46- git commit -m "feat: Update package.json to ${{ env.GIT_TAG }}" -a
47- echo "::set-output name=sha::$(git rev-parse HEAD)"
48-
49- - name : Check sha
50- run : echo "SHA ${SHA}"
51- env :
52- SHA : ${{ steps.commit.outputs.sha }}
53-
54- - name : Create Tag
55- if : steps.check_update.outputs.changed == '1'
56- run : git tag ${{ env.GIT_TAG }}
57-
58- - name : Push changes
59- if : env.DRY_RUN == 'false' && steps.check_update.outputs.changed == '1'
60- uses : ad-m/github-push-action@master
61- with :
62- github_token : ${{ secrets.GITHUB_TOKEN }}
63- branch : ${{ github.ref }}
64- tags : true
65-
66- - name : Push changes (dry_run)
67- if : env.DRY_RUN == 'true' && steps.check_update.outputs.changed == '1'
68- uses : ad-m/github-push-action@master
69- with :
70- github_token : ${{ secrets.GITHUB_TOKEN }}
71- branch : ${{ env.DRY_RUN_BRANCH_PREFIX }}-${{ env.GIT_TAG }}
72- tags : false
21+ uses : Cysharp/Actions/.github/workflows/update-packagejson.yaml@main
22+ with :
23+ file-path : ./RuntimeUnitTestToolkit/Assets/RuntimeUnitTestToolkit/package.json
24+ tag : ${{ github.event.inputs.tag }}
25+ dry-run : ${{ fromJson(github.event.inputs.dry-run) }}
7326
7427 build-unity :
7528 needs : [update-packagejson]
@@ -82,13 +35,13 @@ jobs:
8235 runs-on : ubuntu-latest
8336 timeout-minutes : 15
8437 steps :
85- - uses : actions/checkout@v2
38+ - uses : actions/checkout@v3
8639 with :
8740 ref : ${{ needs.update-packagejson.outputs.sha }}
8841 # Execute scripts: Export Package
8942 # /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod PackageExporter.Export
9043 - name : Export unitypackage
91- uses : game-ci/unity-builder@v2.0-alpha-6
44+ uses : game-ci/unity-builder@v2
9245 env :
9346 UNITY_PACKAGE_VERSION : ${{ env.GIT_TAG }}
9447 UNITY_LICENSE : ${{ secrets[matrix.license] }}
9952 buildMethod : PackageExporter.Export
10053 versioning : None
10154
102- - name : check all .meta is commited
103- run : |
104- if git ls-files --others --exclude-standard -t | grep --regexp='[.]meta$'; then
105- echo "Detected .meta file generated. Do you forgot commit a .meta file?"
106- exit 1
107- else
108- echo "Great, all .meta files are commited."
109- fi
110- working-directory : RuntimeUnitTestToolkit
55+ - uses : Cysharp/Actions/.github/actions/check-metas@main # check meta files
56+ with :
57+ directory : RuntimeUnitTestToolkit
11158
11259 # Store artifacts.
11360 - uses : actions/upload-artifact@v1
@@ -116,9 +63,10 @@ jobs:
11663 path : ./RuntimeUnitTestToolkit/RuntimeUnitTestToolkit.${{ env.GIT_TAG }}.unitypackage
11764
11865 create-release :
119- if : github.event.inputs.dry_run == 'false'
66+ if : github.event.inputs.dry-run == 'false'
12067 needs : [update-packagejson, build-unity]
12168 runs-on : ubuntu-latest
69+ timeout-minutes : 10
12270 steps :
12371 # Create Release
12472 - uses : actions/create-release@v1
@@ -144,14 +92,8 @@ jobs:
14492 asset_content_type : application/octet-stream
14593
14694 cleanup :
147- if : github.event.inputs.dry_run == 'true'
148- needs : [build-unity]
149- runs-on : ubuntu-latest
150- env :
151- GIT_TAG : ${{ github.event.inputs.tag }}
152- steps :
153- - name : Delete branch
154- uses : dawidd6/action-delete-branch@v3
155- with :
156- github_token : ${{ github.token }}
157- branches : ${{ env.DRY_RUN_BRANCH_PREFIX }}-${{ env.GIT_TAG }}
95+ if : needs.update-packagejson.outputs.is-branch-created == 'true'
96+ needs : [update-packagejson, build-unity]
97+ uses : Cysharp/Actions/.github/workflows/clean-packagejson-branch.yaml@main
98+ with :
99+ branch : ${{ needs.update-packagejson.outputs.branch-name }}
0 commit comments