Skip to content

Commit c53f01c

Browse files
committed
Packaging Update
# Added - Added LICENCE. - Added build workflow. - Added release workflow. - Added PackageTools. # Changed - Update Unity from 2020.3.1f1 to 2020.8.1f1.
1 parent 5eca08b commit c53f01c

16 files changed

+2764
-1805
lines changed

.github/workflows/build.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Build
2+
3+
on:
4+
pull_request: {}
5+
push: { branches: [main] }
6+
7+
jobs:
8+
build:
9+
name: ${{ matrix.targetPlatform }}
10+
if: "((github.event_name == 'push' && github.repository_owner == 'mackysoft') || startsWith(github.event.pull_request.head.label, 'mackysoft:'))"
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
targetPlatform:
16+
- StandaloneOSX # Build a macOS standalone (Intel 64-bit).
17+
- StandaloneWindows # Build a Windows standalone.
18+
- StandaloneWindows64 # Build a Windows 64-bit standalone.
19+
- StandaloneLinux64 # Build a Linux 64-bit standalone.
20+
- iOS # Build an iOS player.
21+
- Android # Build an Android .apk standalone app.
22+
- WebGL # WebGL.
23+
24+
steps:
25+
# Checkout
26+
- name: Checkout
27+
uses: actions/checkout@v2
28+
with:
29+
fetch-depth: 0
30+
lfs: true
31+
32+
# Cache
33+
- name: Cache
34+
uses: actions/cache@v2
35+
with:
36+
path: Library
37+
key: Library-${{ matrix.targetPlatform }}
38+
restore-keys: Library-
39+
40+
# Build
41+
- name: Build
42+
uses: game-ci/unity-builder@v2
43+
env:
44+
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE_2020 }}
45+
with:
46+
targetPlatform: ${{ matrix.targetPlatform }}

.github/workflows/release.yaml

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: "tag: git tag you want create. (sample 1.0.0)"
8+
required: true
9+
10+
env:
11+
GIT_TAG: ${{ github.event.inputs.tag }}
12+
13+
jobs:
14+
update-packagejson:
15+
runs-on: ubuntu-latest
16+
env:
17+
TARGET_FILE: ./Assets/MackySoft/MackySoft.SerializeReferenceExtensions/package.json
18+
outputs:
19+
sha: ${{ steps.commit.outputs.sha }}
20+
steps:
21+
- uses: actions/checkout@v2
22+
- name: Output package.json (Before)
23+
run: cat ${{ env.TARGET_FILE}}
24+
25+
- name: Update package.json to version ${{ env.GIT_TAG }}
26+
run: sed -i -e "s/\(\"version\":\) \"\(.*\)\",/\1 \"${{ env.GIT_TAG }}\",/" ${{ env.TARGET_FILE }}
27+
28+
- name: Check update
29+
id: check_update
30+
run: |
31+
cat ${{ env.TARGET_FILE}}
32+
git diff --exit-code || echo "::set-output name=changed::1"
33+
34+
- name: Commit files
35+
id: commit
36+
if: steps.check_update.outputs.changed == '1'
37+
run: |
38+
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
39+
git config --local user.name "github-actions[bot]"
40+
git commit -m "feat: Update package.json to ${{ env.GIT_TAG }}" -a
41+
echo "::set-output name=sha::$(git rev-parse HEAD)"
42+
43+
- name: Check sha
44+
run: echo "SHA ${SHA}"
45+
env:
46+
SHA: ${{ steps.commit.outputs.sha }}
47+
48+
- name: Create Tag
49+
if: steps.check_update.outputs.changed == '1'
50+
run: git tag ${{ env.GIT_TAG }}
51+
52+
- name: Push changes
53+
if: steps.check_update.outputs.changed == '1'
54+
uses: ad-m/github-push-action@master
55+
with:
56+
github_token: ${{ secrets.GITHUB_TOKEN }}
57+
branch: ${{ github.ref }}
58+
tags: true
59+
60+
build:
61+
needs: [update-packagejson]
62+
strategy:
63+
matrix:
64+
unity: ["2020.3.8f1"]
65+
include:
66+
- unityVersion: 2020.3.8f1
67+
license: UNITY_LICENSE_2020
68+
runs-on: ubuntu-latest
69+
timeout-minutes: 15
70+
steps:
71+
- run: echo ${{ needs.update-packagejson.outputs.sha }}
72+
- uses: actions/checkout@v2
73+
with:
74+
ref: ${{ needs.update-packagejson.outputs.sha }}
75+
76+
- name: Export unitypackage
77+
uses: game-ci/unity-builder@v2
78+
env:
79+
UNITY_LICENSE: ${{ secrets[matrix.license] }}
80+
with:
81+
projectPath: .
82+
unityVersion: ${{ matrix.unityVersion }}
83+
targetPlatform: StandaloneLinux64
84+
buildMethod: MackySoft.PackageTools.Editor.UnityPackageExporter.Export
85+
versioning: None
86+
87+
- name: check all .meta is commited
88+
run: |
89+
if git ls-files --others --exclude-standard -t | grep --regexp='[.]meta$'; then
90+
echo "Detected .meta file generated. Do you forgot commit a .meta file?"
91+
exit 1
92+
else
93+
echo "Great, all .meta files are commited."
94+
fi
95+
working-directory: .
96+
97+
# Store artifacts.
98+
- uses: actions/upload-artifact@v2
99+
with:
100+
name: SerializeReference-Extensions.unitypackage
101+
path: ./Build/SerializeReference-Extensions.unitypackage
102+
103+
create-release:
104+
needs: [update-packagejson, build]
105+
runs-on: ubuntu-latest
106+
steps:
107+
# Create Releases
108+
- uses: actions/create-release@v1
109+
id: create_release
110+
env:
111+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
112+
with:
113+
tag_name: ${{ env.GIT_TAG }}
114+
release_name: ${{ env.GIT_TAG }}
115+
commitish: ${{ needs.update-packagejson.outputs.sha }}
116+
draft: true
117+
prerelease: false
118+
119+
# Download(All) Artifacts to current directory
120+
- uses: actions/download-artifact@v2
121+
122+
# Upload to Releases(unitypackage)
123+
- uses: actions/upload-release-asset@v1
124+
env:
125+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
126+
with:
127+
upload_url: ${{ steps.create_release.outputs.upload_url }}
128+
asset_path: ./SerializeReference-Extensions.unitypackage/SerializeReference-Extensions.unitypackage
129+
asset_name: SerializeReference-Extensions.unitypackage
130+
asset_content_type: application/octet-stream

0 commit comments

Comments
 (0)