Skip to content

Commit 166f3b5

Browse files
committed
feat: add build workflow
1 parent 633f6d5 commit 166f3b5

File tree

83 files changed

+13635
-7
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+13635
-7
lines changed

.github/workflows/activation.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Acquire activation file
2+
3+
on: workflow_dispatch
4+
5+
jobs:
6+
activation:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Request manual activation file
10+
id: getManualLicenseFile
11+
uses: game-ci/unity-request-activation-file@v2
12+
with:
13+
unityVersion: 2021.3.25f1
14+
- name: Expose as artifact
15+
uses: actions/upload-artifact@v2
16+
with:
17+
name: ${{ steps.getManualLicenseFile.outputs.filePath }}
18+
path: ${{ steps.getManualLicenseFile.outputs.filePath }}

.github/workflows/release.yml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: Release to GitHub
2+
3+
on: workflow_dispatch
4+
5+
permissions:
6+
contents: write
7+
8+
jobs:
9+
release:
10+
name: Create release
11+
runs-on: ubuntu-latest
12+
outputs:
13+
release: ${{ steps.tag.outputs.release }}
14+
version: ${{ steps.tag.outputs.version }}
15+
steps:
16+
- uses: actions/checkout@v3
17+
with:
18+
fetch-depth: 0
19+
- name: Generate changelog
20+
uses: TriPSs/conventional-changelog-action@v3
21+
id: changelog
22+
with:
23+
git-push: false
24+
output-file: false
25+
skip-git-pull: true
26+
skip-version-file: true
27+
skip-commit: true
28+
skip-tag: true
29+
- name: Create release
30+
id: tag
31+
uses: actions/github-script@v6
32+
with:
33+
result-encoding: string
34+
script: |
35+
const skipped = '${{ steps.changelog.outputs.skipped }}';
36+
const tag = '${{ steps.changelog.outputs.tag }}';
37+
const version = '${{ steps.changelog.outputs.version }}';
38+
const body = `${{ steps.changelog.outputs.clean_changelog }}`;
39+
40+
if (skipped !== 'false') {
41+
core.setFailed('No changes to publish.');
42+
return;
43+
}
44+
45+
const release = await github.rest.repos.createRelease({
46+
owner: context.repo.owner,
47+
repo: context.repo.repo,
48+
tag_name: tag,
49+
name: tag,
50+
body,
51+
});
52+
53+
core.setOutput('version', version);
54+
core.setOutput('release', release.data.id);
55+
build:
56+
name: Build for ${{ matrix.targetPlatform }}
57+
needs: release
58+
runs-on: ubuntu-latest
59+
strategy:
60+
matrix:
61+
targetPlatform:
62+
- StandaloneWindows64
63+
- StandaloneLinux64
64+
- StandaloneOSX
65+
steps:
66+
- uses: actions/checkout@v3
67+
with:
68+
lfs: true
69+
- uses: actions/cache@v3
70+
with:
71+
path: Library
72+
key: Library-${{ matrix.targetPlatform }}
73+
restore-keys: Library-
74+
- uses: game-ci/unity-builder@v2
75+
env:
76+
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
77+
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
78+
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
79+
with:
80+
gitPrivateToken: ${{ secrets.PACKAGES_TOKEN }}
81+
unityVersion: 2021.3.25f1
82+
targetPlatform: ${{ matrix.targetPlatform }}
83+
versioning: Custom
84+
version: ${{ needs.release.outputs.version }}
85+
- name: Create zip archive
86+
run: |
87+
cd build/${{ matrix.targetPlatform }}
88+
zip -r ../../artifact.zip .
89+
- name: Upload asset
90+
uses: actions/github-script@v6
91+
with:
92+
script: |
93+
const release_id = `${{ needs.release.outputs.release }}`;
94+
const name = `Build-${{ matrix.targetPlatform }}.zip`;
95+
96+
await github.rest.repos.uploadReleaseAsset({
97+
owner: context.repo.owner,
98+
repo: context.repo.repo,
99+
release_id,
100+
name,
101+
data: require("fs").readFileSync("artifact.zip"),
102+
});

.github/workflows/verify.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Verify Pull Request
2+
3+
on:
4+
pull_request: { }
5+
workflow_dispatch: { }
6+
7+
jobs:
8+
build:
9+
name: Build for ${{ matrix.targetPlatform }}
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
targetPlatform:
14+
- StandaloneWindows64
15+
- StandaloneLinux64
16+
- StandaloneOSX
17+
steps:
18+
- uses: actions/checkout@v3
19+
with:
20+
lfs: true
21+
- uses: actions/cache@v3
22+
with:
23+
path: Library
24+
key: Library-${{ matrix.targetPlatform }}
25+
restore-keys: Library-
26+
- uses: game-ci/unity-builder@v2
27+
env:
28+
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
29+
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
30+
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
31+
with:
32+
gitPrivateToken: ${{ secrets.PACKAGES_TOKEN }}
33+
unityVersion: 2021.3.25f1
34+
targetPlatform: ${{ matrix.targetPlatform }}
35+
versioning: Tag

0 commit comments

Comments
 (0)