Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 50 additions & 4 deletions .github/workflows/release-unity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,14 @@ on:
default: 0
rcNumber:
type: number
description: Rc version number, if required, 0.0.0-PREVIEW.RCX
description: "Rc version number (0 = auto: next RC after the latest tag)"
required: false
default: 0
nugetVersion:
type: string
description: "CLI nuget version to bundle. Blank = keep the SDK's current dependency."
required: false
default: ""
releaseType:
type: choice
description: What type of release is this?
Expand Down Expand Up @@ -76,9 +81,39 @@ jobs:
echo releaseType=${{ inputs.releaseType }}

- uses: actions/checkout@v4
with:
with:
ref: ${{ github.event.inputs.commit }}

# For an RC with rcNumber 0, derive the next RC from existing tags (read
# from the remote, so a shallow clone is fine). Lets you cut RC2..N without
# tracking the number. An explicit rcNumber > 0 wins. ~Claude
- name: Resolve RC number
id: rc
if: ${{ inputs.releaseType == 'rc' }}
run: |
set -euo pipefail
rc="${{ inputs.rcNumber }}"
if [ "$rc" = "0" ] || [ -z "$rc" ]; then
max=$(git ls-remote --tags origin "unity-sdk-${{ inputs.major }}.${{ inputs.minor }}.${{ inputs.patch }}-PREVIEW.RC*" \
| sed -nE 's#.*-PREVIEW\.RC([0-9]+)$#\1#p' | sort -n | tail -1)
if [ -z "$max" ]; then rc=1; else rc=$((max + 1)); fi
fi
echo "NUMBER=$rc" >> "$GITHUB_OUTPUT"
echo "Resolved RC number: $rc"

# Fail fast, before any build, if the changelog's top entry does not match
# the version line being cut. ~Claude
- name: Guard changelog freshness
if: ${{ inputs.releaseType == 'rc' || inputs.releaseType == 'production' }}
run: |
want="${{ inputs.major }}.${{ inputs.minor }}.${{ inputs.patch }}"
top=$(grep -m1 -oP '^##\s*\[\K[0-9]+\.[0-9]+\.[0-9]+' client/Packages/com.beamable/CHANGELOG.md || true)
if [ "$top" != "$want" ]; then
echo "::error file=client/Packages/com.beamable/CHANGELOG.md::Changelog top entry '$top' does not match $want. Update the changelog before releasing."
exit 1
fi
echo "Changelog OK: $top"

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
Expand Down Expand Up @@ -136,8 +171,8 @@ jobs:
run: beam version construct 0 0 0 --nightly > version.txt

- name: Get Version Number (RC)
if: ${{ inputs.releaseType == 'rc' }}
run: beam version construct ${{ inputs.major }} ${{ inputs.minor }} ${{ inputs.patch }} --rc ${{ inputs.rcNumber }} > version.txt
if: ${{ inputs.releaseType == 'rc' }}
run: beam version construct ${{ inputs.major }} ${{ inputs.minor }} ${{ inputs.patch }} --rc ${{ steps.rc.outputs.NUMBER }} > version.txt

- name: Get Version Number (Exp)
if: ${{ inputs.releaseType == 'exp' }}
Expand Down Expand Up @@ -194,6 +229,17 @@ jobs:
VERSION: ${{ steps.version.outputs.VERSION }}
ENVIRONMENT: ${{steps.version.outputs.BUILD_ENV}}

# Point the SDK at a specific CLI nuget version without hand-editing the
# committed file. Blank input keeps the current dependency (reuse the
# previous CLI artifact when the CLI has not changed). ~Claude
- name: Override bundled CLI nuget version
if: ${{ inputs.nugetVersion != '' }}
run: |
jq --arg v "${{ inputs.nugetVersion }}" '.nugetPackageVersion = $v' \
client/Packages/com.beamable/Runtime/Environment/Resources/versions-default.json > tmp.json \
&& mv tmp.json client/Packages/com.beamable/Runtime/Environment/Resources/versions-default.json
cat client/Packages/com.beamable/Runtime/Environment/Resources/versions-default.json

- name: Apply Nuget Version to Unity SDK
run: |
beam unity download-all-nuget-packages ./client --logs v
Expand Down
Loading