Skip to content

Create Release PR

Create Release PR #48

name: Create Release PR
# Note: The "Use workflow from" dropdown selects which version of THIS workflow to run.
# Always select "main" unless you're testing workflow changes from another branch.
# The "base_branch" input below determines where the release PR will be targeted.
on:
workflow_dispatch:
inputs:
version:
description: "New SDK version (e.g. 5.1.38 or 5.2.0-beta1)"
type: string
required: true
base_branch:
description: "Target branch for the PR (e.g. main for regular releases, 5.4-main for 5.4.x releases)"
type: string
required: false
default: "main"
permissions:
contents: write
pull-requests: write
jobs:
bump-version:
runs-on: ubuntu-latest
env:
VERSION: ${{ github.event.inputs.version }}
BASE_BRANCH: ${{ github.event.inputs.base_branch || 'main' }}
BRANCH: rel/${{ github.event.inputs.version }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- 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 version-specific releases, e.g., 5.4-main, 5.5-main)"
exit 1
fi
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 0
fetch-tags: true
- name: Setup Git User
uses: OneSignal/sdk-shared/.github/actions/setup-git-user@main
- 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: Update SDK_VERSION in gradle.properties
run: |
sed -i "s/^SDK_VERSION=.*/SDK_VERSION=$VERSION/" OneSignalSDK/gradle.properties
sed -i "s/^SDK_VERSION=.*/SDK_VERSION=$VERSION/" examples/demo/gradle.properties
- name: Commit and Push changes
run: |
git commit -am "chore: bump SDK_VERSION to $VERSION"
git push origin "$BRANCH"
create-release:
needs: bump-version
uses: OneSignal/sdk-shared/.github/workflows/create-release.yml@main
with:
release_branch: rel/${{ github.event.inputs.version }}
target_branch: ${{ github.event.inputs.base_branch || 'main' }}