Skip to content

Build Release

Build Release #26

Workflow file for this run

name: Build Release
on:
workflow_dispatch:
create:
push:
branches:
- 'release/*'
jobs:
build:
runs-on: macos-latest
if: ${{ (github.event.ref_type == 'branch') && startsWith(github.ref, 'refs/heads/release/') }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Extract version from branch name
id: extract_version
run: |
branch_name=${{ github.ref_name }}
if [[ "$branch_name" == release/* ]]; then
version=${branch_name#release/}
echo "Version: $version"
echo "::set-output name=version::${version}"
else
echo "Not a release branch."
exit 1
fi
- name: Download release artifact
id: download_artifact
run: |
artifact_name="Firebase.zip"
echo "Getting release notes for $REPO version $VERSION"
echo "Release ID: $release_id"
echo "Getting release notes for $REPO version $VERSION"
# Get release notes
release_notes=$(gh release view $VERSION --repo $REPO --json body | jq '.body')
echo "::set-output name=release_notes::${release_notes}"
echo "Downloading artifact from $REPO version $VERSION"
# Download the release artifact for that release ID
gh release download $VERSION --repo $REPO --pattern $artifact_name --dir ./
env:
REPO: firebase/firebase-ios-sdk
VERSION: ${{ steps.extract_version.outputs.version }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Package release
run: |
cd .scripts
sh ./package.sh
cd ..
git add .
git commit -m "Updated Package.swift and sources for latest firebase sdks"
git push -u origin release/$VERSION
env:
VERSION: ${{ steps.extract_version.outputs.version }}
REPO: https://github.com/${{ github.repository }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: Firebase
path: artifacts/*
- name: Open pull request
run: |
gh pr create --title "Update to Firebase $VERSION" --body "$RELEASE_NOTES" --base main --head release/$VERSION
echo "::set-output name=number::${number}"
env:
VERSION: ${{ steps.extract_version.outputs.version }}
RELEASE_NOTES: ${{ steps.download_artifact.outputs.release_notes }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Approve pull request
run: |
gh pr review --approve
env:
GITHUB_TOKEN: ${{ secrets.AFRESHY_PAT }}
- name: Merge pull request
run: |
gh pr merge --squash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}