Skip to content

Release

Release #261

Workflow file for this run

# 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: Structure Temp Directory
run: |
mkdir -p ${{ github.workspace }}/temp
mkdir -p ${{ github.workspace }}/temp/@galacean/engine
cp -r ${{ github.workspace }}/packages/galacean/dist ${{ github.workspace }}/temp/@galacean/engine
mkdir -p ${{ github.workspace }}/temp/@galacean/engine-xr
cp -r ${{ github.workspace }}/packages/xr/dist ${{ github.workspace }}/temp/@galacean/engine-xr
mkdir -p ${{ github.workspace }}/temp/@galacean/engine-shader-lab
cp -r ${{ github.workspace }}/packages/shader-lab/dist ${{ github.workspace }}/temp/@galacean/engine-shader-lab
mkdir -p ${{ github.workspace }}/temp/@galacean/engine-physics-lite
cp -r ${{ github.workspace }}/packages/physics-lite/dist ${{ github.workspace }}/temp/@galacean/engine-physics-lite
mkdir -p ${{ github.workspace }}/temp/@galacean/engine-physics-physx
cp -r ${{ github.workspace }}/packages/physics-physx/dist ${{ github.workspace }}/temp/@galacean/engine-physics-physx
mkdir -p ${{ github.workspace }}/temp/@galacean/engine-toolkit
cp -r ${{ github.workspace }}/engine-toolkit/packages/galacean-engine-toolkit/dist/umd ${{ github.workspace }}/temp/@galacean/engine-toolkit
mkdir -p ${{ github.workspace }}/temp/@galacean/engine-lottie
cp -r ${{ github.workspace }}/engine-lottie/dist ${{ github.workspace }}/temp/@galacean/engine-lottie
mkdir -p ${{ github.workspace }}/temp/@galacean/engine-spine
cp -r ${{ github.workspace }}/engine-spine/dist ${{ github.workspace }}/temp/@galacean/engine-spine
find ${{ github.workspace }}/temp
- name: Ensure Adapter 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 }}/temp/@galacean/engine/dist/browser.js",
"${{ github.workspace }}/temp/@galacean/engine-xr/dist/browser.js",
"${{ github.workspace }}/temp/@galacean/engine-shader-lab/dist/browser.js",
"${{ github.workspace }}/temp/@galacean/engine-physics-lite/dist/browser.js",
"${{ github.workspace }}/temp/@galacean/engine-physics-physx/dist/browser.js",
"${{ github.workspace }}/temp/@galacean/engine-toolkit/umd/browser.js",
"${{ github.workspace }}/temp/@galacean/engine-lottie/dist/browser.js",
"${{ github.workspace }}/temp/@galacean/engine-spine/dist/browser.js"
],
"jsWASMLoader": [
"${{ github.workspace }}/packages/physics-physx/libs/physx.release.js"
],
"outputDir": "${{ github.workspace }}/platform-adapter/dist"
}
- name: Print Adapter Bundle
run: find ${{ github.workspace }}/platform-adapter -type f
- 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}}