Updated Package.swift and sources for latest firebase sdks (#86) #37
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: Release Version | |
on: | |
workflow_dispatch: | |
inputs: | |
version_override: | |
description: 'Version override' | |
required: false | |
type: string | |
push: | |
branches: | |
- 'main' | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Get latest Firebase release | |
id: latest_firebase_release | |
run: | | |
version=$(gh release view --repo $REPO --json tagName --jq '.tagName') | |
if [ -z "$VERSION_OVERRIDE" ]; then | |
echo "::set-output name=version::${version}" | |
else | |
echo "::set-output name=version::${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=exists::true" | |
else | |
echo "::set-output name=exists::false" | |
fi | |
env: | |
BRANCH: release/${{ steps.latest_firebase_release.outputs.version }} | |
- name: Check if release exists | |
if: steps.check_branch.outputs.exists == 'true' | |
id: check_release | |
run: | | |
echo "Checking if release $version exists..." | |
# Check if the release exists by querying the GitHub API | |
if gh api repos/${{ github.repository }}/releases/tags/$VERSION --silent || false; then | |
echo "Release $VERSION exists." | |
echo "::set-output name=exists::true" | |
else | |
echo "Release $VERSION does not exist." | |
echo "::set-output name=exists::false" | |
fi | |
env: | |
VERSION: ${{ steps.latest_firebase_release.outputs.version }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create release | |
if: ${{ (steps.check_release.outputs.exists == 'false') && (steps.check_branch.outputs.exists == 'true') }} | |
run: | | |
branch_name=release/$VERSION | |
workflow_name="Build Release" | |
echo "Getting build workflow run for branch: $branch_name" | |
# Get the latest workflow run ID for the branch | |
run_id=$(gh run list --branch $branch_name --workflow "Build Release" --status success --limit 1 --json databaseId | jq -r '.[0].databaseId') | |
if [ "$run_id" = "null" ]; then | |
echo "No build workflow run found for branch $branch_name" | |
else | |
echo "Found build workflow run ID: $run_id" | |
artifact_count=$(gh api repos/${{ github.repository }}/actions/runs/$run_id/artifacts | jq -r '.total_count') | |
if [ "$artifact_count" -eq 0 ]; then | |
echo "No artifacts found for workflow run $run_id" | |
exit 0 | |
fi | |
# Download all artifacts from the workflow run | |
gh run download $run_id --repo ${{ github.repository }} --dir ./artifacts/ | |
echo "Creating a release for version $version" | |
gh release view $VERSION --repo $FIREBASE_REPO --json body | jq -r '.body' >> release_notes.txt | |
# Create a new release | |
gh release create $VERSION ./artifacts/Firebase/* \ | |
--title "$VERSION" \ | |
--notes-file release_notes.txt | |
fi | |
env: | |
VERSION: ${{ steps.latest_firebase_release.outputs.version }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
FIREBASE_REPO: firebase/firebase-ios-sdk | |