-
Notifications
You must be signed in to change notification settings - Fork 231
256 lines (243 loc) · 8.4 KB
/
release.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
name: Build & Release (manual)
# Manually triggered
# $ gh workflow run release.yml
on:
workflow_dispatch:
inputs:
version:
description: Select Release type - major, minor or patch(for version upgrade).
required: true
default: patch
type: choice
options:
- patch
- minor
- major
jobs:
static-analysis:
runs-on: macos-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Run static analysis
run: |
xcodebuild analyze -project BranchSDK.xcodeproj
# TODO: current repo merge controls are preventing this step from passing
# version-bump:
# runs-on: macos-latest
# needs: [static-analysis]
# steps:
# - name: Check out code
# uses: actions/checkout@v4
# - name: Update Version
# run: |
# if [[ ${{ inputs.version }} == "patch" ]]; then
# ./scripts/version.sh -i
# elif [[ ${{ inputs.version }} == "minor" ]]; then
# ./scripts/version.sh -im
# elif [[ ${{ inputs.version }} == "major" ]]; then
# ./scripts/version.sh -iM
# else
# echo "Invalid option"
# fi
# git config user.name "Branch SDK Team"
# git config user.email [email protected]
# git add BranchSDK.xcodeproj/project.pbxproj BranchSDK/BNCConfig.m BranchSDK.podspec Branch-TestBed/Framework-Info.plist ./scripts/version.sh
# git commit BranchSDK.xcodeproj/project.pbxproj BranchSDK/BNCConfig.m BranchSDK.podspec Branch-TestBed/Framework-Info.plist ./scripts/version.sh -m'Updated version'
# echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
# git push
build-framework:
runs-on: macos-latest
#needs: [version-bump]
needs: [static-analysis]
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Build xcframework
run: |
./scripts/prep_xcframework.sh
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: release_framework
path: |
./Branch.zip
./checksum.txt
build-noidfa-framework:
runs-on: macos-latest
#needs: [version-bump]
needs: [static-analysis]
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Build xcframework
run: |
./scripts/prep_xcframework_noidfa.sh
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: framework-noidfa
path: |
./Branch_noidfa.zip
./checksum_noidfa.txt
build-static-framework:
runs-on: macos-latest
#needs: [version-bump]
needs: [static-analysis]
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Build static xcframework
run: |
./scripts/prep_static_xcframework.sh
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: static-framework
path: |
./Branch_static.zip
./checksum_static.txt
build-static-noidfa-framework:
runs-on: macos-latest
#needs: [version-bump]
needs: [static-analysis]
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Build static xcframework
run: |
./scripts/prep_static_xcframework_noidfa.sh
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: static-framework-noidfa
path: |
./Branch_static_noidfa.zip
./checksum_static_noidfa.txt
release:
runs-on: macos-latest
needs: [build-framework, build-static-framework, build-noidfa-framework, build-static-noidfa-framework]
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Ruby 2.7
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7'
# The CocoaPods dependencies are only used by the
# Branch-TestBed.xcworkspace (for unit tests).
# Bring in the Ruby deps from the cache for quick availability of
# pod command. Not using cached Pods folder.
- name: Restore cache
uses: actions/cache@v3
with:
path: |
vendor
Branch-TestBed/Pods
key: ${{ runner.os }}-${{ hashFiles('Gemfile.lock','Branch-TestBed/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-
- name: Install Ruby dependencies
run: |
bundle config set --local path vendor
bundle check || bundle install
- name: Download build artifacts
uses: actions/download-artifact@v4
- name: Publish to CocoaPods
run: |
# TODO: Authenticate using repo secret
# bundle exec pod trunk push Branch.podspec
echo "TODO: This 👆"
# 3. Create GitHub release. Also creates a tag.
- name: Get current version
id: get-version
run: |
bundle exec fastlane current_version
echo "Current version is $(cat fastlane/.version)."
echo "version=$(cat fastlane/.version)" >> $GITHUB_OUTPUT
- name: Create GitHub Release
uses: actions/github-script@v7
with:
script: |
const createRelease = require('./.github/custom-scripts/create-release');
const tagName = '${{ steps.get-version.outputs.version }}';
const sha = '${{ steps.commit-checksums.outputs.sha }}';
await createRelease({
core,
context,
github,
sha,
version: tagName,
});
- name: Upload Release Assets
uses: actions/github-script@v7
with:
script: |
const uploadAsset = require('./.github/custom-scripts/upload-asset');
const tagName = '${{ steps.get-version.outputs.version }}';
const { data } = await github.rest.repos.getReleaseByTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag: tagName,
});
const releaseId = data.id;
await uploadAsset({
github,
context,
releaseId,
assetName: 'Branch.zip',
path: 'release_framework/Branch.zip',
});
await uploadAsset({
github,
context,
releaseId,
assetName: 'Branch_noidfa.zip',
path: 'framework-noidfa/Branch_noidfa.zip',
});
await uploadAsset({
github,
context,
releaseId,
assetName: 'Branch_static.zip',
path: 'static-framework/Branch_static.zip',
});
await uploadAsset({
github,
context,
releaseId,
assetName: 'Branch_static_noidfa.zip',
path: 'static-framework-noidfa/Branch_static_noidfa.zip',
});
await uploadAsset({
github,
context,
releaseId,
assetName: 'checksum_noidfa',
path: 'framework-noidfa/checksum_noidfa.txt',
});
await uploadAsset({
github,
context,
releaseId,
assetName: 'checksum_static',
path: 'static-framework/checksum_static.txt',
});
await uploadAsset({
github,
context,
releaseId,
assetName: 'checksum_static_noidfa',
path: 'static-framework-noidfa/checksum_static_noidfa.txt',
});
await uploadAsset({
github,
context,
releaseId,
assetName: 'checksum',
path: 'release_framework/checksum.txt',
});
- name: Trigger workflow in iOS Branch SDK spm repo for updating code and creating release
run: |
curl -X POST https://api.github.com/repos/BranchMetrics/ios-branch-sdk-spm/dispatches -H 'Accept: application/vnd.github.everest-preview+json' -u "branchlet:${{ secrets.BRANCHLET_ACCESS_TOKEN_PUBLIC}}" --data '{"event_type": "Trigger Workflow", "client_payload":
{ "tag":"${{steps.get-version.outputs.version}}"}}'