Skip to content

Commit 26dae71

Browse files
authored
Merge pull request #779 from immutable/feat/sdk-304-audience-version-bump
chore: add audience release workflow support, remove marketplace
2 parents d2f4f0b + edee238 commit 26dae71

5 files changed

Lines changed: 163 additions & 69 deletions

File tree

.github/scripts/check_team_membership.sh

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,27 @@ set -x
44

55
USER=$1
66

7-
response=$(gh api \
8-
-H "Accept: application/vnd.github+json" \
9-
-H "X-GitHub-Api-Version: 2022-11-28" \
10-
"/orgs/immutable/teams/passport/memberships/${USER}")
11-
12-
echo "$response"
13-
14-
if echo "$response" | grep -q '"state":"active"'; then
15-
IS_MEMBER=true
16-
else
17-
IS_MEMBER=false
18-
fi
7+
TEAMS=(
8+
"ped-stream-sdk-integrations-list"
9+
"ped-stream-blockchain-services-list"
10+
)
11+
12+
IS_MEMBER=false
13+
14+
for TEAM in "${TEAMS[@]}"; do
15+
response=$(gh api \
16+
-H "Accept: application/vnd.github+json" \
17+
-H "X-GitHub-Api-Version: 2022-11-28" \
18+
"/orgs/immutable/teams/${TEAM}/memberships/${USER}")
19+
20+
echo "$response"
21+
22+
if echo "$response" | grep -q '"state":"active"'; then
23+
IS_MEMBER=true
24+
break
25+
fi
26+
done
27+
1928
echo "$IS_MEMBER"
2029

2130
# Set the environment variable for the GitHub workflow

.github/workflows/release.yml

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,18 @@ jobs:
2222
- name: Get the latest tag
2323
run: |
2424
git fetch --tags
25-
LATEST_TAG="$(git describe --tags "$(git rev-list --tags --max-count=1)")"
25+
LATEST_TAG="$(git tag --sort=-creatordate | head -n 1)"
2626
echo "LATEST_TAG=${LATEST_TAG}" >> "$GITHUB_ENV"
27+
if [[ "$LATEST_TAG" == audience/* ]]; then
28+
echo "IS_AUDIENCE=true" >> "$GITHUB_ENV"
29+
else
30+
echo "IS_AUDIENCE=false" >> "$GITHUB_ENV"
31+
fi
32+
if [[ "$LATEST_TAG" == *alpha* ]]; then
33+
echo "IS_PRERELEASE=true" >> "$GITHUB_ENV"
34+
else
35+
echo "IS_PRERELEASE=false" >> "$GITHUB_ENV"
36+
fi
2737
2838
- name: Pull LFS
2939
run: git lfs pull
@@ -62,6 +72,7 @@ jobs:
6272
}
6373
6474
- name: Extract TS SDK version from index.html
75+
if: env.IS_AUDIENCE != 'true'
6576
id: extract_ts_sdk_version
6677
run: |
6778
version=$(grep -oP '"x-sdk-version":"ts-immutable-sdk-\K[0-9]+\.[0-9]+\.[0-9]+' ./src/Packages/Passport/Runtime/Resources/index.html | head -n 1)
@@ -73,7 +84,15 @@ jobs:
7384
7485
version=$(echo "$version" | tr -d '\r\n')
7586
76-
echo "VERSION=${version}" >> "$GITHUB_ENV"
87+
echo "TS_SDK_VERSION=${version}" >> "$GITHUB_ENV"
88+
89+
- name: Build release body suffix
90+
run: |
91+
if [[ "$IS_AUDIENCE" != "true" && -n "$TS_SDK_VERSION" ]]; then
92+
echo "RELEASE_BODY_SUFFIX=Game bridge built from Immutable Typescript SDK version $TS_SDK_VERSION" >> "$GITHUB_ENV"
93+
else
94+
echo "RELEASE_BODY_SUFFIX=" >> "$GITHUB_ENV"
95+
fi
7796
7897
- name: Create Release
7998
id: create_release
@@ -86,6 +105,6 @@ jobs:
86105
body: |
87106
${{steps.github_release.outputs.changelog}}
88107
89-
Game bridge built from Immutable Typescript SDK version ${{ env.VERSION }}
108+
${{ env.RELEASE_BODY_SUFFIX }}
90109
draft: false
91-
prerelease: false
110+
prerelease: ${{ env.IS_PRERELEASE }}

.github/workflows/tag.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
jobs:
99
create-tag:
10-
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release')
10+
if: github.event.pull_request.merged == true && (contains(github.event.pull_request.labels.*.name, 'passport-release') || contains(github.event.pull_request.labels.*.name, 'audience-release'))
1111
runs-on: ubuntu-latest
1212

1313
steps:
@@ -22,13 +22,20 @@ jobs:
2222
- name: Install jq
2323
run: sudo apt-get install -y jq
2424

25-
- name: Extract version from package.json
25+
- name: Extract version and set tag
2626
id: extract_version
2727
run: |
28-
VERSION=$(jq -r .version ./src/Packages/Passport/package.json)
29-
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
28+
IS_AUDIENCE="${{ contains(github.event.pull_request.labels.*.name, 'audience-release') }}"
29+
if [[ "$IS_AUDIENCE" == "true" ]]; then
30+
VERSION=$(jq -r .version ./src/Packages/Audience/package.json)
31+
echo "TAG=audience/v$VERSION" >> "$GITHUB_ENV"
32+
else
33+
VERSION=$(jq -r .version ./src/Packages/Passport/package.json)
34+
echo "TAG=v$VERSION" >> "$GITHUB_ENV"
35+
fi
3036
3137
- name: Check TS SDK version exists in index.html
38+
if: contains(github.event.pull_request.labels.*.name, 'passport-release')
3239
id: check_ts_sdk_version
3340
run: |
3441
version=$(grep -oP '"x-sdk-version":"ts-immutable-sdk-\K[0-9]+\.[0-9]+\.[0-9]+' ./src/Packages/Passport/Runtime/Resources/index.html | head -n 1)
@@ -41,6 +48,6 @@ jobs:
4148
- name: Create Tag
4249
uses: negz/create-tag@v1
4350
with:
44-
version: "v${{ env.VERSION }}"
45-
message: "Version ${{ env.VERSION }}"
51+
version: "${{ env.TAG }}"
52+
message: "Version ${{ env.TAG }}"
4653
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test-audience-sample-app.yml

Lines changed: 47 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,6 @@ name: Audience SDK PlayMode (IL2CPP + Mono)
22

33
on:
44
pull_request:
5-
paths:
6-
- 'src/Packages/Audience/Runtime/**'
7-
- 'src/Packages/Audience/Tests/**'
8-
- 'src/Packages/Audience/package.json'
9-
- 'src/Packages/Audience/Directory.Build.props'
10-
- 'src/Packages/Audience/link.xml'
11-
- 'examples/audience/Assets/**'
12-
- 'examples/audience/Packages/**'
13-
- 'examples/audience/ProjectSettings/**'
14-
- '.github/workflows/test-audience-sample-app.yml'
155
schedule:
166
# Weekly full-matrix run on the default branch. Saturday 14:00 UTC.
177
- cron: '0 14 * * 6'
@@ -26,6 +16,30 @@ env:
2616
AUDIENCE_TEST_RUN_ID: ${{ github.run_id }}-${{ github.run_attempt }}
2717

2818
jobs:
19+
# Detects whether any Audience-relevant paths changed in this PR.
20+
# schedule/workflow_dispatch always returns true to run the full matrix.
21+
paths-changed:
22+
runs-on: ubuntu-latest
23+
outputs:
24+
audience: ${{ steps.check.outputs.audience }}
25+
steps:
26+
- uses: actions/checkout@v4
27+
with:
28+
fetch-depth: 0
29+
- id: check
30+
run: |
31+
if [[ "${{ github.event_name }}" != "pull_request" ]]; then
32+
echo "audience=true" >> "$GITHUB_OUTPUT"
33+
exit 0
34+
fi
35+
git fetch origin ${{ github.base_ref }} --depth=1
36+
if git diff --name-only origin/${{ github.base_ref }}...HEAD \
37+
| grep -qE '^(src/Packages/Audience/|examples/audience/|\.github/workflows/test-audience-sample-app\.yml)'; then
38+
echo "audience=true" >> "$GITHUB_OUTPUT"
39+
else
40+
echo "audience=false" >> "$GITHUB_OUTPUT"
41+
fi
42+
2943
# SSOT for the unity matrix and PR-only excludes. Both playmode and
3044
# mobile-build consume these outputs via fromJSON. Source data lives
3145
# in .github/scripts/audience/matrix-shared.json.
@@ -36,8 +50,11 @@ jobs:
3650
# data into the literal exclude objects GitHub Actions matrix.exclude
3751
# expects, and asserts each rule matched exactly one cell descriptor.
3852
setup:
53+
needs: paths-changed
3954
if: |
40-
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false)
55+
(github.event_name == 'pull_request'
56+
&& github.event.pull_request.head.repo.fork == false
57+
&& needs.paths-changed.outputs.audience == 'true')
4158
|| github.event_name == 'schedule'
4259
|| github.event_name == 'workflow_dispatch'
4360
runs-on: ubuntu-latest
@@ -250,3 +267,22 @@ jobs:
250267
path: |
251268
examples/audience/Builds/Android/*.apk
252269
examples/audience/Logs/**
270+
271+
# Required check. Passes immediately when no Audience paths changed;
272+
# fails if playmode or mobile-build tests failed or were cancelled.
273+
ci-gate:
274+
needs: [playmode, mobile-build]
275+
if: always() && github.event_name == 'pull_request'
276+
runs-on: ubuntu-latest
277+
steps:
278+
- name: Check results
279+
run: |
280+
PLAYMODE="${{ needs.playmode.result }}"
281+
MOBILE="${{ needs.mobile-build.result }}"
282+
if [[ "$PLAYMODE" == "failure" || "$PLAYMODE" == "cancelled" ]]; then
283+
echo "::error::playmode tests $PLAYMODE" && exit 1
284+
fi
285+
if [[ "$MOBILE" == "failure" || "$MOBILE" == "cancelled" ]]; then
286+
echo "::error::mobile-build $MOBILE" && exit 1
287+
fi
288+
echo "Gate passed (playmode=$PLAYMODE, mobile-build=$MOBILE)"

.github/workflows/update-version.yml

Lines changed: 59 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,30 @@ name: "Update SDK version"
33
on:
44
workflow_dispatch:
55
inputs:
6+
package:
7+
type: choice
8+
description: Package to release
9+
options:
10+
- passport
11+
- audience
12+
required: true
13+
default: passport
614
upgrade_type:
715
type: choice
816
description: Upgrade Type
917
options:
1018
- patch
1119
- minor
12-
# - major
1320
required: true
1421
default: patch
1522
mark_as_alpha:
1623
type: boolean
17-
description: Mark as alpha release
24+
description: Mark as alpha release (Passport only)
1825
required: false
1926
default: false
2027

2128
env:
29+
PACKAGE: ${{ github.event.inputs.package || 'passport' }}
2230
UPGRADE_TYPE: ${{ github.event.inputs.upgrade_type || 'patch' }}
2331
MARK_AS_ALPHA: ${{ github.event.inputs.mark_as_alpha || false }}
2432

@@ -53,26 +61,43 @@ jobs:
5361
- name: Update Version in package.json
5462
id: replace_version
5563
run: |
56-
PASSPORT_FILE=./src/Packages/Passport/package.json
57-
MARKETPLACE_FILE=./src/Packages/Marketplace/package.json
58-
59-
CURRENT_VERSION=$(jq -r '.version' $PASSPORT_FILE)
64+
if [[ "$PACKAGE" == "audience" ]]; then
65+
FILE=./src/Packages/Audience/package.json
66+
else
67+
FILE=./src/Packages/Passport/package.json
68+
fi
69+
70+
CURRENT_VERSION=$(jq -r '.version' $FILE)
6071
echo "CURRENT_VERSION: $CURRENT_VERSION"
6172
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT_VERSION"
6273
63-
HAS_ALPHA=$(echo "$CURRENT_VERSION" | grep -q "\.alpha" && echo "true" || echo "false")
64-
echo "HAS_ALPHA: $HAS_ALPHA"
6574
NEW_VERSION=""
6675
67-
if [[ "$HAS_ALPHA" == "true" ]]; then
68-
# If version is alpha and upgrade type is patch, don't increment patch
69-
if [ "$UPGRADE_TYPE" == "patch" ]; then
70-
NEW_VERSION="$MAJOR.$MINOR.$PATCH"
71-
elif [ "$UPGRADE_TYPE" == "minor" ]; then
72-
MINOR=$((MINOR + 1))
73-
PATCH=0
76+
if [[ "$PACKAGE" == "passport" ]]; then
77+
HAS_ALPHA=$(echo "$CURRENT_VERSION" | grep -q "\.alpha" && echo "true" || echo "false")
78+
echo "HAS_ALPHA: $HAS_ALPHA"
79+
80+
if [[ "$HAS_ALPHA" == "true" ]]; then
81+
if [ "$UPGRADE_TYPE" == "patch" ]; then
82+
NEW_VERSION="$MAJOR.$MINOR.$PATCH"
83+
elif [ "$UPGRADE_TYPE" == "minor" ]; then
84+
MINOR=$((MINOR + 1))
85+
PATCH=0
86+
NEW_VERSION="$MAJOR.$MINOR.$PATCH"
87+
fi
88+
else
89+
if [ "$UPGRADE_TYPE" == "patch" ]; then
90+
PATCH=$((PATCH + 1))
91+
elif [ "$UPGRADE_TYPE" == "minor" ]; then
92+
MINOR=$((MINOR + 1))
93+
PATCH=0
94+
fi
7495
NEW_VERSION="$MAJOR.$MINOR.$PATCH"
7596
fi
97+
98+
if [[ "$MARK_AS_ALPHA" == "true" && "$HAS_ALPHA" == "false" ]]; then
99+
NEW_VERSION="$NEW_VERSION.alpha"
100+
fi
76101
else
77102
if [ "$UPGRADE_TYPE" == "patch" ]; then
78103
PATCH=$((PATCH + 1))
@@ -83,20 +108,12 @@ jobs:
83108
NEW_VERSION="$MAJOR.$MINOR.$PATCH"
84109
fi
85110
86-
if [[ "$MARK_AS_ALPHA" == "true" && "$HAS_ALPHA" == "false" ]]; then
87-
NEW_VERSION="$NEW_VERSION.alpha"
88-
fi
89-
90-
# Update Passport package.json
91-
jq --arg version "$NEW_VERSION" '.version = $version' $PASSPORT_FILE > tmp.$$.json && mv tmp.$$.json $PASSPORT_FILE
92-
echo "Updated version in Passport package.json from $CURRENT_VERSION to $NEW_VERSION"
93-
94-
# Update Marketplace package.json
95-
jq --arg version "$NEW_VERSION" '.version = $version' $MARKETPLACE_FILE > tmp.$$.json && mv tmp.$$.json $MARKETPLACE_FILE
96-
echo "Updated version in Marketplace package.json from $CURRENT_VERSION to $NEW_VERSION"
111+
jq --arg version "$NEW_VERSION" '.version = $version' $FILE > tmp.$$.json && mv tmp.$$.json $FILE
112+
echo "Updated version in $FILE from $CURRENT_VERSION to $NEW_VERSION"
97113
echo "version=$NEW_VERSION" >> "$GITHUB_OUTPUT"
98114
99115
- name: Update SDK Version in SdkVersionInfoHelpers.cs
116+
if: env.PACKAGE == 'passport'
100117
id: replace_engine_sdk_version
101118
run: |
102119
FILE=./src/Packages/Passport/Runtime/Scripts/Private/Helpers/SdkVersionInfoHelpers.cs
@@ -105,31 +122,37 @@ jobs:
105122
echo "Updated SDK version in SdkVersionInfoHelpers.cs to $NEW_VERSION"
106123
107124
- name: Ensure Samples~/SamplesScenesScripts directory exists and clear contents
125+
if: env.PACKAGE == 'passport'
108126
run: |
109127
mkdir -p ./src/Packages/Passport/Samples~/SamplesScenesScripts
110128
rm -rf ./src/Packages/Passport/Samples~/SamplesScenesScripts/*
111129
112-
mkdir -p ./src/Packages/Marketplace/Samples~/SamplesScenesScripts
113-
rm -rf ./src/Packages/Marketplace/Samples~/SamplesScenesScripts/*
114-
115130
- name: Install rsync
131+
if: env.PACKAGE == 'passport'
116132
run: sudo apt-get install -y rsync
117133

118134
- name: Copy sample scenes and scripts to Passport package Samples~
135+
if: env.PACKAGE == 'passport'
119136
id: copy_sample_scenes_and_scripts
120137
run: |
121138
rsync -av --exclude='*.meta' ./examples/passport/Assets/Scenes/Passport ./src/Packages/Passport/Samples~/SamplesScenesScripts/Scenes/
122139
rsync -av --exclude='*.meta' --exclude='features.json' --exclude='_prompts~/' --exclude='_tutorials~/' ./examples/passport/Assets/Scripts/Passport ./src/Packages/Passport/Samples~/SamplesScenesScripts/Scripts/
123140
124-
rsync -av --exclude='*.meta' ./examples/passport/Assets/Scenes/Marketplace ./src/Packages/Marketplace/Samples~/SamplesScenesScripts/Scenes/
125-
rsync -av --exclude='*.meta' ./examples/passport/Assets/Scripts/Marketplace ./src/Packages/Marketplace/Samples~/SamplesScenesScripts/Scripts/
141+
- name: Set release label
142+
id: set_label
143+
run: |
144+
if [[ "$PACKAGE" == "audience" ]]; then
145+
echo "label=audience-release" >> "$GITHUB_OUTPUT"
146+
else
147+
echo "label=passport-release" >> "$GITHUB_OUTPUT"
148+
fi
126149
127150
- uses: gr2m/create-or-update-pull-request-action@v1
128151
env:
129152
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
130153
with:
131-
title: "chore: update version"
132-
body: "Update version in package.json"
133-
branch: "chore/update-version-${{ steps.replace_version.outputs.version }}"
134-
commit-message: "chore: update version"
135-
labels: release
154+
title: "chore: bump ${{ github.event.inputs.package }} to ${{ steps.replace_version.outputs.version }}"
155+
body: "Bump ${{ github.event.inputs.package }} package version to ${{ steps.replace_version.outputs.version }}."
156+
branch: "chore/bump-${{ github.event.inputs.package }}-${{ steps.replace_version.outputs.version }}"
157+
commit-message: "chore: bump ${{ github.event.inputs.package }} to ${{ steps.replace_version.outputs.version }}"
158+
labels: ${{ steps.set_label.outputs.label }}

0 commit comments

Comments
 (0)