Create Release Branch #46
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create Release Branch | |
on: | |
workflow_dispatch: | |
inputs: | |
version_override: | |
description: 'Version override' | |
required: false | |
type: string | |
schedule: | |
# Every day at 05:00 EST (10:00 UTC) | |
- cron: '0 10 * * *' | |
jobs: | |
create-release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set git credentials | |
run: | | |
/usr/bin/git config --global --add url."https://${{ secrets.AFRESHY_PAT }}:x-oauth-basic@github".insteadOf ssh://git@github | |
/usr/bin/git config --global --add url."https://${{ secrets.AFRESHY_PAT }}:x-oauth-basic@github".insteadOf https://github | |
/usr/bin/git config --global --add url."https://${{ secrets.AFRESHY_PAT }}:x-oauth-basic@github".insteadOf git@github | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.AFRESHY_PAT }} | |
- name: Get latest Firebase release | |
id: latest_firebase_release | |
run: | | |
latest_firebase_release=$(gh release view --repo $REPO --json tagName --jq '.tagName') | |
if [ -z "$VERSION_OVERRIDE" ]; then | |
echo "::set-output name=latest_firebase_release::${latest_firebase_release}" | |
else | |
echo "::set-output name=latest_firebase_release::${VERSION_OVERRIDE}" | |
fi | |
env: | |
REPO: firebase/firebase-ios-sdk | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
VERSION_OVERRIDE: ${{ inputs.version_override }} | |
- name: Check if branch exists | |
id: check_branch | |
run: | | |
git fetch origin | |
if git ls-remote --heads origin "$BRANCH" | grep -q "$BRANCH"; then | |
echo "::set-output name=branch_exists::true" | |
else | |
echo "::set-output name=branch_exists::false" | |
fi | |
env: | |
BRANCH: release/${{ steps.latest_firebase_release.outputs.latest_firebase_release }} | |
- name: Create release branch | |
if: steps.check_branch.outputs.branch_exists == 'false' | |
run: | | |
git checkout -b $BRANCH | |
git push origin $BRANCH | |
env: | |
BRANCH: release/${{ steps.latest_firebase_release.outputs.latest_firebase_release }} |