-
-
Notifications
You must be signed in to change notification settings - Fork 309
131 lines (114 loc) · 4.66 KB
/
release.yml
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# This is a basic workflow to help you get started with Actions
name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- name: Checkout Engine repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
run_install: true
# after pnpm
- name: Use Node.js LTS
uses: actions/setup-node@v4
with:
node-version: '>=22.6.0'
registry-url: https://registry.npmjs.org/
cache: pnpm
- name: Build Engine
run: pnpm b:all
- name: Cache Engine Package
uses: actions/cache@v3
with:
path: ./packages/galacean
key: ${{ runner.os }}-engine-${{ github.sha }}
- name: Checkout Sub-repositories
run: |
git clone https://github.com/galacean/engine-toolkit.git
git clone https://github.com/galacean/engine-lottie.git
git clone https://github.com/galacean/engine-spine.git
- name: Install and Link Engine and Build for Toolkit
working-directory: ./engine-toolkit
run: |
pnpm install
pnpm link ../packages/galacean
pnpm b:all
- name: Install and Link Engine and Build for Lottie
working-directory: ./engine-lottie
run: |
pnpm install --ignore-workspace
pnpm link ../packages/galacean
pnpm build
- name: Install and Link Engine and Build for Spine
working-directory: ./engine-spine
run: |
pnpm install --ignore-workspace
pnpm link ../packages/galacean
pnpm build
- name: Ensure Dist Directory Exists
run: mkdir -p ${{ github.workspace }}/platform-adapter/dist
# Create a mock package.json to specify the path and version of the adapter build result when syncing with the CDN later.
# name is set to @galacean/engine-platform-adapter-release to avoid conflicts with the real package.json
# version is set to the version of the engine package
- name: Create package.json for platform-adapter
run: |
VERSION=$(jq -r '.version' ${{ github.workspace }}/packages/galacean/package.json)
echo "{\"name\": \"@galacean/engine-platform-adapter-release\", \"version\": \"$VERSION\"}" > ${{ github.workspace }}/platform-adapter/package.json
cat ${{ github.workspace }}/platform-adapter/package.json
- name: Bundle polyfill and engine
uses: galacean/platform-adapter@main
env:
ADAPTER_BUNDLE_SETTINGS: |
{
"polyfill": true,
"engine": [
"${{ github.workspace }}/packages/galacean/dist/module.js",
"${{ github.workspace }}/packages/xr/dist/module.js",
"${{ github.workspace }}/packages/shader-lab/dist/module.js",
"${{ github.workspace }}/packages/physics-lite/dist/module.js",
"${{ github.workspace }}/packages/physics-physx/dist/module.js",
"${{ github.workspace }}/engine-lottie/dist/module.js",
"${{ github.workspace }}/engine-spine/dist/module.js",
"${{ github.workspace }}/engine-toolkit/packages/galacean-engine-toolkit/dist/es/index.js"
],
"jsWASMLoader": [
"${{ github.workspace }}/packages/physics-physx/libs/physx.release.js"
],
"outputDir": "${{ github.workspace }}/platform-adapter/dist"
}
- name: Print Adapter Bundle
run: ls -l ${{ github.workspace }}/platform-adapter/dist
- name: Release engine packages and Sync to CDN
uses: galacean/publish@main
if: success() || failure()
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
NPM_CONFIG_PROVENANCE: true
OASISBE_UPLOAD_URL: https://oasisbe.alipay.com/api/file/no-auth/crypto/upload
OASISBE_REQUEST_HEADER: ${{secrets.OASISBE_REQUEST_HEADER}}
OASISBE_PUBLIC_KEY: ${{secrets.OASISBE_PUBLIC_KEY}}
- name: Sync Platform Adapter to CDN
uses: galacean/publish@main
if: success() || failure()
with:
publish: false
packages: |
platform-adapter
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
NPM_CONFIG_PROVENANCE: true
OASISBE_UPLOAD_URL: https://oasisbe.alipay.com/api/file/no-auth/crypto/upload
OASISBE_REQUEST_HEADER: ${{secrets.OASISBE_REQUEST_HEADER}}
OASISBE_PUBLIC_KEY: ${{secrets.OASISBE_PUBLIC_KEY}}