-
Notifications
You must be signed in to change notification settings - Fork 1
87 lines (72 loc) · 2.73 KB
/
deploy.yml
File metadata and controls
87 lines (72 loc) · 2.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Deploy WebGL to Cloudflare Pages
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
on:
release:
types: [published]
workflow_dispatch:
concurrency:
group: pages
cancel-in-progress: false
permissions:
contents: read
jobs:
build-webgl:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Cache Unity Library
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: Library
key: Library-WebGL-6000.3.8f1-${{ hashFiles('Assets/**', 'Packages/manifest.json') }}
restore-keys: |
Library-WebGL-6000.3.8f1-
Library-WebGL-
- name: Fetch tags
run: git fetch origin --tags --force
- name: Inject git commit hash
run: |
mkdir -p Assets/Resources
git rev-parse --short HEAD > Assets/Resources/git-commit.txt
- name: Set version from latest tag
run: |
VERSION=$(git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//' || echo "0.0")
echo "Setting bundleVersion to $VERSION"
sed -i "s/bundleVersion: .*/bundleVersion: $VERSION/" ProjectSettings/ProjectSettings.asset
- name: Build WebGL
uses: game-ci/unity-builder@1d4ee0697f193f54668e98961d79907911f4b4f2 # v4
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
targetPlatform: WebGL
# The commit hash and version injection steps above modify the worktree
# before the build. This is intentional — nothing is pushed back to the
# repository. allowDirtyBuild prevents the builder from rejecting the
# build due to these uncommitted changes.
allowDirtyBuild: true
- name: Upload build artifact
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: webgl-build
path: build/WebGL/WebGL
retention-days: 1
deploy:
runs-on: ubuntu-latest
needs: build-webgl
environment: production
steps:
- name: Download build artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: webgl-build
path: build
- name: Deploy to Cloudflare Pages
uses: cloudflare/wrangler-action@da0e0dfe58b7a431659754fdf3f186c529afbe65 # v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy build --project-name=arrow-thing --commit-dirty=true