Skip to content

Commit 72fce30

Browse files
authored
ci: update engine release workflows (#8956)
* ci: update engine release workflows * ci: skip examples build during package publish * ci: reorder publish checks
1 parent 4b438b6 commit 72fce30

4 files changed

Lines changed: 104 additions & 14 deletions

File tree

.github/workflows/alpha.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Alpha
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: write
8+
9+
jobs:
10+
alpha:
11+
runs-on: ubuntu-latest
12+
if: github.repository == 'playcanvas/engine' && github.ref_name != 'main'
13+
steps:
14+
- name: Generate app token
15+
id: app-token
16+
uses: actions/create-github-app-token@v3
17+
with:
18+
app-id: ${{ secrets.APP_ID }}
19+
private-key: ${{ secrets.APP_KEY }}
20+
21+
- name: Check out code
22+
uses: actions/checkout@v7.0.0
23+
with:
24+
fetch-depth: 0
25+
token: ${{ steps.app-token.outputs.token }}
26+
27+
- name: Set up Node.js 24.x
28+
uses: actions/setup-node@v6
29+
with:
30+
node-version: 24.x
31+
cache: "npm"
32+
33+
- name: Configure Git User
34+
run: |
35+
git config --global user.email "playcanvas[bot]@users.noreply.github.com"
36+
git config --global user.name "PlayCanvas [bot]"
37+
shell: bash
38+
39+
- name: Tag alpha
40+
run: |
41+
base=$(npm pkg get version | sed 's/"//g' | sed 's/-.*//')
42+
version="$base-alpha.${GITHUB_RUN_NUMBER}.${GITHUB_RUN_ATTEMPT}"
43+
npm version "$version" --no-git-tag-version
44+
git commit -m "Alpha $version" -- package.json package-lock.json
45+
git tag "v$version"
46+
git push origin "v$version"

.github/workflows/beta.yml

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: Beta
22

33
on:
4+
schedule:
5+
- cron: "0 2 * * *"
46
workflow_dispatch:
57
inputs:
68
force:
@@ -29,28 +31,45 @@ jobs:
2931
fetch-depth: 0
3032
token: ${{ steps.app-token.outputs.token }}
3133

34+
- name: Set up Node.js 24.x
35+
uses: actions/setup-node@v6
36+
with:
37+
node-version: 24.x
38+
cache: "npm"
39+
3240
- name: Configure Git User
3341
run: |
3442
git config --global user.email "playcanvas[bot]@users.noreply.github.com"
3543
git config --global user.name "PlayCanvas [bot]"
3644
shell: bash
3745

3846
- name: Check for changes
39-
if: github.event.inputs.force == 'false'
47+
id: changes
4048
run: |
41-
last_tag=$(git describe --tags --abbrev=0)
42-
if ! git diff --quiet --exit-code $last_tag; then
43-
echo "Changes found since v$last_tag"
49+
if [[ "${{ github.event.inputs.force }}" == "true" ]]; then
50+
echo "has_changes=true" >> "$GITHUB_OUTPUT"
51+
exit 0
52+
fi
53+
54+
last_tag=$(git describe --tags --match "v*-beta.*" --abbrev=0 2>/dev/null || true)
55+
if [[ -z "$last_tag" ]]; then
56+
echo "No beta tag found"
57+
echo "has_changes=true" >> "$GITHUB_OUTPUT"
58+
elif ! git diff --quiet --exit-code "$last_tag"..HEAD; then
59+
echo "Changes found since $last_tag"
60+
echo "has_changes=true" >> "$GITHUB_OUTPUT"
4461
else
45-
echo "No changes detected since v$last_tag"
46-
exit 1
62+
echo "No changes detected since $last_tag"
63+
echo "has_changes=false" >> "$GITHUB_OUTPUT"
4764
fi
4865
4966
- name: Bump version
67+
if: steps.changes.outputs.has_changes == 'true'
5068
run: |
5169
npm version prerelease --preid=beta
5270
5371
- name: Push version
72+
if: steps.changes.outputs.has_changes == 'true'
5473
run: |
5574
git push origin HEAD:${{ github.ref_name }}
5675
git push origin --tags

.github/workflows/publish.yml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
tags:
66
- "v[0-9]+.[0-9]+.[0-9]+"
7+
- "v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+.[0-9]+"
78
- "v[0-9]+.[0-9]+.[0-9]+-preview.[0-9]+"
89
- "v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+"
910

@@ -32,18 +33,35 @@ jobs:
3233
echo "TAG=${TAG_NAME}" >> $GITHUB_ENV
3334
echo "VERSION=${TAG_NAME/v/}" >> $GITHUB_ENV
3435
35-
- name: Install Dependencies
36-
run: npm install
36+
- name: Install dependencies
37+
run: npm clean-install --progress=false --no-fund
38+
39+
- name: Run ESLint
40+
run: npm run lint
41+
42+
- name: Run unit tests
43+
run: npm test
44+
45+
- name: Build API reference manual
46+
run: npm run docs
3747

3848
- name: Build PlayCanvas
3949
run: npm run build
4050

51+
- name: Run Post-build tests
52+
run: npm run test:build
53+
54+
- name: Compile TypeScript declarations
55+
run: npm run test:types
56+
4157
- name: Run Publint
4258
run: npm run publint
4359

4460
- name: Publish to npm
4561
run: |
46-
if [[ "${{ env.TAG }}" =~ "preview" ]]; then
62+
if [[ "${{ env.TAG }}" =~ "alpha" ]]; then
63+
tag=alpha
64+
elif [[ "${{ env.TAG }}" =~ "preview" ]]; then
4765
tag=preview
4866
elif [[ "${{ env.TAG }}" =~ "beta" ]]; then
4967
tag=beta

release.sh

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ PRE_ID_BETA="beta"
66
PRE_ID_PREVIEW="preview"
77

88
RELEASE_PREFIX="release-"
9-
RELEASE_REGEX="^$RELEASE_PREFIX[0-9]+.[0-9]+$"
9+
RELEASE_REGEX="^${RELEASE_PREFIX}[0-9]+\\.[0-9]+$"
1010

1111
# Help
1212
HELP=$1
@@ -36,6 +36,16 @@ fi
3636
BRANCH=$(git branch --show-current)
3737
VERSION=$(npm pkg get version | sed 's/"//g')
3838

39+
if [[ "$BRANCH" == "$MAIN_BRANCH" || $BRANCH =~ $RELEASE_REGEX ]]; then
40+
git fetch origin --tags
41+
LOCAL=$(git rev-parse HEAD)
42+
REMOTE=$(git rev-parse "origin/$BRANCH")
43+
if [[ "$LOCAL" != "$REMOTE" ]]; then
44+
echo "Local '$BRANCH' is not up to date with 'origin/$BRANCH'. Please pull before running this script."
45+
exit 1
46+
fi
47+
fi
48+
3949
PARTS=(${VERSION//./ })
4050
MAJOR=${PARTS[0]}
4151
MINOR=${PARTS[1]}
@@ -95,9 +105,6 @@ if [[ $BRANCH =~ $RELEASE_REGEX ]]; then
95105

96106
echo "Finalize release [BRANCH=$BRANCH, VERSION=$VERSION, TYPE=$TYPE]"
97107

98-
# Fetch all remote tags
99-
git fetch --tags
100-
101108
# Calculate the next version
102109
npm version $TYPE --preid=$PRE_ID_PREVIEW --no-git-tag-version >> /dev/null
103110
NEXT_VERSION=$(npm pkg get version | sed 's/"//g')
@@ -116,4 +123,4 @@ fi
116123

117124
echo "Unrecognized branch '$BRANCH'."
118125
echo "Run '--help' for more information."
119-
exit 1
126+
exit 1

0 commit comments

Comments
 (0)