Skip to content

fixes (#59)

fixes (#59) #9

Workflow file for this run

name: Release Version
on:
workflow_dispatch:
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')
echo "::set-output name=version::${version}"
env:
REPO: firebase/firebase-ios-sdk
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check if release exists
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'
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" --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"
# Download all artifacts from the workflow run
gh run download $run_id --repo ${{ github.repository }} --dir ./artifacts/
echo "Creating a release for version $version"
firebase_release_id=$(gh api repos/$FIREBASE_REPO/releases/tags/$VERSION --jq '.id')
release_notes=$(gh release view $release_id --repo $FIREBASE_REPO --json body | jq -r '.body')
# Create a new release
gh release create $version ./artifacts/* \
--title "$version" \
--notes "$release_notes"
fi
env:
VERSION: ${{ steps.latest_firebase_release.outputs.version }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FIREBASE_REPO: firebase/firebase-ios-sdk