39
39
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
40
40
41
41
42
- - name : Download artifacts from latest build run
42
+ - name : Create release
43
43
if : steps.check_release.outputs.exists == 'false'
44
44
run : |
45
45
branch_name=release/$VERSION
@@ -48,39 +48,30 @@ jobs:
48
48
echo "Getting build workflow run for branch: $branch_name"
49
49
50
50
# 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')
55
52
56
53
if [ -z "$run_id" ]; then
57
54
echo "No build workflow run found for branch $branch_name"
58
- exit 1
59
55
else
60
56
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"
61
70
fi
62
71
63
- # Download all artifacts from the workflow run
64
- gh run download $run_id --repo ${{ github.repository }} --dir ./artifacts/
65
72
env :
66
73
VERSION : ${{ steps.latest_firebase_release.outputs.version }}
67
74
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 :
82
75
FIREBASE_REPO : firebase/firebase-ios-sdk
83
- VERSION : ${{ steps.latest_firebase_release.outputs.version }}
84
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
85
76
86
77
0 commit comments