Skip to content

test on the working branch #1

test on the working branch

test on the working branch #1

name: Create Unity Release PR
on:
push:
branches:
- "ci-unity"
workflow_dispatch:
inputs:
version:
description: 'New Unity SDK version (e.g. 5.4.0-alpha01 or 3.2.1)'
type: string
required: true
base_branch:
description: 'Target branch for the PR (e.g. main for regular releases, 5.4-main for patch releases)'
type: string
required: false
default: 'ci-unity'
permissions:
contents: write
pull-requests: write
jobs:
create-unity-release:
runs-on: ubuntu-latest
env:
VERSION: ${{ github.event.inputs.version }}
BASE_BRANCH: ${{ github.event.inputs.base_branch || 'main' }}
BRANCH: release/${{ github.event.inputs.version }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: 📋 Display Configuration
run: |
echo "============================================"
echo "🎮 Creating Unity SDK Release"
echo "📦 Version: $VERSION"
echo "🎯 Base Branch (PR Target): $BASE_BRANCH"
echo "🌿 Release Branch (to create): $BRANCH"
echo "============================================"
- name: ✅ Validate Base Branch
run: |
if [[ "$BASE_BRANCH" == "main" ]]; then
echo "✅ Valid base branch: main"
elif [[ "$BASE_BRANCH" =~ ^[0-9]+\.[0-9]+-main$ ]]; then
echo "✅ Valid base branch: $BASE_BRANCH"
else
echo "❌ ERROR: Invalid base branch '$BASE_BRANCH'"
echo ""
echo "Base branch must be either:"
echo " - 'main' (for regular releases)"
echo " - 'X.Y-main' (for patch lines, e.g., 5.4-main)"
exit 1
fi
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Create release branch from base
run: |
if git ls-remote --exit-code --heads origin "$BRANCH"; then
echo "Deleting remote branch $BRANCH"
git push origin --delete "$BRANCH"
fi
echo "Creating release branch $BRANCH from $BASE_BRANCH"
git checkout -b "$BRANCH" origin/$BASE_BRANCH
- name: Run composeRelease.sh
run: |
chmod +x ./composeRelease.sh
./composeRelease.sh $VERSION
shell: bash
- name: Commit and Push version bump
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
if git diff --quiet; then
echo "No version changes detected."
else
git commit -am "chore(release): prepare Unity SDK v$VERSION"
git push origin "$BRANCH"
fi
- name: Generate PR Body
run: |
echo "## 🎮 Unity SDK Release v$VERSION" > pr_body.md
echo "" >> pr_body.md
echo "**Summary:**" >> pr_body.md
echo "- Automated release PR created by CI." >> pr_body.md
echo "- Includes version bumps and changelog updates performed by composeRelease.sh." >> pr_body.md
echo "" >> pr_body.md
echo "**Next Steps:**" >> pr_body.md
echo "1. Review and approve this PR." >> pr_body.md
echo "2. Merge into \`$BASE_BRANCH\`." >> pr_body.md
echo "3. Verify the generated draft GitHub release and attach the updated *.unitypackage if needed." >> pr_body.md
echo "" >> pr_body.md
echo "_This PR was auto-generated by create-unity-release CI._" >> pr_body.md
- name: Create Pull Request
run: |
gh pr create \
--title "Release Unity SDK v$VERSION" \
--body-file pr_body.md \
--head "$BRANCH" \
--base "$BASE_BRANCH"