Skip to content

Commit 4358c33

Browse files
authored
more fixes (#53)
* more fixes * more fixes
1 parent 3c369b7 commit 4358c33

File tree

1 file changed

+15
-24
lines changed

1 file changed

+15
-24
lines changed

.github/workflows/release.yml

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4040

4141

42-
- name: Download artifacts from latest build run
42+
- name: Create release
4343
if: steps.check_release.outputs.exists == 'false'
4444
run: |
4545
branch_name=release/$VERSION
@@ -48,39 +48,30 @@ jobs:
4848
echo "Getting build workflow run for branch: $branch_name"
4949
5050
# Get the latest workflow run ID for the branch
51-
run_id=$(gh api repos/${{ github.repository }}/actions/runs \
52-
--paginate \
53-
--jq ".workflow_runs[] | select(.head_branch == \"$branch_name\" and .name == \"$workflow_name\") | .id" | head -n 1)
54-
51+
run_id=$(gh run list --branch $branch_name --workflow "Build Release" --limit 1 --json databaseId | jq -r '.[0].databaseId')
5552
5653
if [ -z "$run_id" ]; then
5754
echo "No build workflow run found for branch $branch_name"
58-
exit 1
5955
else
6056
echo "Found build workflow run ID: $run_id"
57+
58+
# Download all artifacts from the workflow run
59+
gh run download $run_id --repo ${{ github.repository }} --dir ./artifacts/
60+
61+
echo "Creating a release for version $version"
62+
63+
firebase_release_id=$(gh api repos/$FIREBASE_REPO/releases/tags/$VERSION --jq '.id')
64+
release_notes=$(gh release view $release_id --repo $FIREBASE_REPO --json body | jq -r '.body')
65+
66+
# Create a new release
67+
gh release create $version ./artifacts/* \
68+
--title "$version" \
69+
--notes "$release_notes"
6170
fi
6271

63-
# Download all artifacts from the workflow run
64-
gh run download $run_id --repo ${{ github.repository }} --dir ./artifacts/
6572
env:
6673
VERSION: ${{ steps.latest_firebase_release.outputs.version }}
6774
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68-
69-
- name: Create release and upload artifacts
70-
if: steps.check_release.outputs.exists == 'false'
71-
run: |
72-
echo "Creating a release for version $version"
73-
74-
firebase_release_id=$(gh api repos/$FIREBASE_REPO/releases/tags/$VERSION --jq '.id')
75-
release_notes=$(gh release view $release_id --repo $FIREBASE_REPO --json body | jq -r '.body')
76-
77-
# Create a new release
78-
gh release create $version ./artifacts/* \
79-
--title "$version" \
80-
--notes "$release_notes"
81-
env:
8275
FIREBASE_REPO: firebase/firebase-ios-sdk
83-
VERSION: ${{ steps.latest_firebase_release.outputs.version }}
84-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8576

8677

0 commit comments

Comments
 (0)