forked from akaffenberger/firebase-ios-sdk-xcframeworks
-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (77 loc) · 2.81 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
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 }}