@@ -26,40 +26,51 @@ jobs:
2626 sha : ${{ steps.commit.outputs.sha }}
2727 steps :
2828 - uses : actions/checkout@v2
29- - name : before
29+ - name : Output package.json (Before)
3030 run : cat ${{ env.TARGET_FILE}}
31- - name : update package.json to version ${{ env.GIT_TAG }}
31+
32+ - name : Update package.json to version ${{ env.GIT_TAG }}
3233 run : sed -i -e "s/\(\"version\":\) \"\(.*\)\",/\1 \"${{ env.GIT_TAG }}\",/" ${{ env.TARGET_FILE }}
33- - name : after
34- run : cat ${{ env.TARGET_FILE}}
34+
35+ - name : Check update
36+ id : check_update
37+ run : |
38+ cat ${{ env.TARGET_FILE}}
39+ git diff --exit-code || echo "::set-output name=changed::1"
40+
3541 - name : Commit files
3642 id : commit
43+ if : steps.check_update.outputs.changed == '1'
3744 run : |
3845 git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
3946 git config --local user.name "github-actions[bot]"
4047 git commit -m "feat: Update package.json to ${{ env.GIT_TAG }}" -a
4148 echo "::set-output name=sha::$(git rev-parse HEAD)"
42- - name : check sha
49+
50+ - name : Check sha
4351 run : echo "SHA ${SHA}"
4452 env :
4553 SHA : ${{ steps.commit.outputs.sha }}
46- - name : tag
54+
55+ - name : Create Tag
56+ if : steps.check_update.outputs.changed == '1'
4757 run : git tag ${{ env.GIT_TAG }}
48- if : env.DRY_RUN == 'false'
58+
4959 - name : Push changes
60+ if : env.DRY_RUN == 'false' && steps.check_update.outputs.changed == '1'
5061 uses : ad-m/github-push-action@master
5162 with :
5263 github_token : ${{ secrets.GITHUB_TOKEN }}
5364 branch : ${{ github.ref }}
5465 tags : true
55- if : env.DRY_RUN == 'false'
66+
5667 - name : Push changes (dry_run)
68+ if : env.DRY_RUN == 'true' && steps.check_update.outputs.changed == '1'
5769 uses : ad-m/github-push-action@master
5870 with :
5971 github_token : ${{ secrets.GITHUB_TOKEN }}
6072 branch : ${{ env.DRY_RUN_BRANCH_PREFIX }}-${{ env.GIT_TAG }}
6173 tags : false
62- if : env.DRY_RUN == 'true'
6374
6475 build-dotnet :
6576 needs : [update-packagejson]
@@ -95,35 +106,26 @@ jobs:
95106 unity : ["2019.3.9f1"]
96107 include :
97108 - unity : 2019.3.9f1
98- license : UNITY_2019_3
109+ license : UNITY_LICENSE_2019
99110 runs-on : ubuntu-latest
100111 timeout-minutes : 15
101- container :
102- # with linux-il2cpp. image from https://hub.docker.com/r/gableroux/unity3d/tags
103- image : gableroux/unity3d:${{ matrix.unity }}-linux-il2cpp
104112 steps :
105- # Ubuntu 18.04 git is too old, use ppa latest git.
106- - run : |
107- apt-get update && apt-get install --no-install-recommends -y software-properties-common && add-apt-repository -y ppa:git-core/ppa
108- apt-get update && apt-get install --no-install-recommends -y git
109113 - uses : actions/checkout@v2
110114 with :
111115 ref : ${{ needs.update-packagejson.outputs.sha }}
112- # activate Unity from manual license file(ulf)
113- - run : echo -n "$UNITY_LICENSE" >> .Unity.ulf
114- env :
115- UNITY_LICENSE : ${{ secrets[matrix.license] }}
116- - run : /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -manualLicenseFile .Unity.ulf || exit 0
117-
118- # set release tag(*.*.*) to env.GIT_TAG
119- - run : echo "GIT_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
120-
121116 # Execute scripts: Export Package
117+ # /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod PackageExporter.Export
122118 - name : Export unitypackage
123- run : /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod PackageExporter.Export
124- working-directory : src/ZString.Unity
119+ 125120 env :
121+ UNITY_LICENSE : ${{ secrets[matrix.license] }}
126122 UNITY_PACKAGE_VERSION : ${{ env.GIT_TAG }}
123+ with :
124+ projectPath : src/ZString.Unity
125+ unityVersion : ${{ matrix.unity }}
126+ targetPlatform : StandaloneLinux64
127+ buildMethod : PackageExporter.Export
128+ versioning : None
127129
128130 - name : check all .meta is commited
129131 run : |
0 commit comments