Skip to content

Commit 446c14d

Browse files
authored
Merge pull request #42 from Cysharp/chore/image
chore: new unity build with unityci/editor
2 parents 0be4d40 + 56b7a7b commit 446c14d

File tree

2 files changed

+46
-48
lines changed

2 files changed

+46
-48
lines changed

.github/workflows/build-debug.yml

+16-20
Original file line numberDiff line numberDiff line change
@@ -30,34 +30,30 @@ jobs:
3030
if: "!(contains(github.event.head_commit.message, '[skip ci]') || contains(github.event.head_commit.message, '[ci skip]')) && ((github.event_name == 'push' && github.repository_owner == 'Cysharp') || startsWith(github.event.pull_request.head.label, 'Cysharp:'))"
3131
strategy:
3232
matrix:
33-
unity: ["2019.3.9f1", "2020.1.0b5"]
33+
unity: ["2019.3.9f1", "2019.4.13f1", "2020.1.12f1"]
3434
include:
3535
- unity: 2019.3.9f1
36-
license: UNITY_2019_3
37-
- unity: 2020.1.0b5
38-
license: UNITY_2020_1
36+
license: UNITY_LICENSE_2019
37+
- unity: 2019.4.13f1
38+
license: UNITY_LICENSE_2019
39+
- unity: 2020.1.12f1
40+
license: UNITY_LICENSE_2020
3941
runs-on: ubuntu-latest
4042
timeout-minutes: 15
41-
container:
42-
# with linux-il2cpp. image from https://hub.docker.com/r/gableroux/unity3d/tags
43-
image: gableroux/unity3d:${{ matrix.unity }}-linux-il2cpp
4443
steps:
45-
# Ubuntu 18.04 git is too old, use ppa latest git.
46-
- run: |
47-
apt-get update && apt-get install --no-install-recommends -y software-properties-common && add-apt-repository -y ppa:git-core/ppa
48-
apt-get update && apt-get install --no-install-recommends -y git
4944
- uses: actions/checkout@v2
50-
# activate Unity from manual license file(ulf)
51-
- run: echo -n "$UNITY_LICENSE" >> .Unity.ulf
52-
env:
53-
UNITY_LICENSE: ${{ secrets[matrix.license] }}
54-
- name: Activate Unity, always returns a success. But if a subsequent run fails, the activation may have failed(if succeeded, shows `Next license update check is after` and not shows other message(like GUID != GUID). If fails not). In that case, upload the artifact's .alf file to https://license.unity3d.com/manual to get the .ulf file and set it to secrets.
55-
run: /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -manualLicenseFile .Unity.ulf || exit 0
56-
5745
# Execute scripts: Export Package
46+
# /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod PackageExporter.Export
5847
- name: Export unitypackage
59-
run: /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod PackageExporter.Export
60-
working-directory: src/ZString.Unity
48+
uses: game-ci/[email protected]
49+
env:
50+
UNITY_LICENSE: ${{ secrets[matrix.license] }}
51+
with:
52+
projectPath: src/ZString.Unity
53+
unityVersion: ${{ matrix.unity }}
54+
targetPlatform: StandaloneLinux64
55+
buildMethod: PackageExporter.Export
56+
versioning: None
6157

6258
- name: check all .meta is commited
6359
run: |

.github/workflows/build-release.yml

+30-28
Original file line numberDiff line numberDiff line change
@@ -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+
uses: game-ci/[email protected]
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

Comments
 (0)