1
1
name : Tag & Release
2
2
3
- # -----
4
- # TODO: Define this workflow.
5
- # -----
6
-
7
3
# Manually triggered
8
- # $ gh workflow run integration-tests .yml
4
+ # $ gh workflow run -f version=1.40.0 release .yml
9
5
on : workflow_dispatch
6
+ inputs :
7
+ version :
8
+ description : The version number to use for this release.
9
+ required : true
10
10
11
+ # Builds two frameworks in parallel, then commits checksums, releases
12
+ # with the frameworks and checksums attached to the release.
11
13
jobs :
14
+ build :
15
+ runs-on : macos-latest
16
+ steps :
17
+ - name : Check out code
18
+ uses : actions/checkout@v2
19
+ - name : Build xcframework
20
+ working-directory : carthage-files
21
+ run : |
22
+ xcodebuild -scheme Branch-xcframework
23
+ cd build
24
+ zip -rqy Branch.zip Branch.xcframework/
25
+ echo '#checksum for Branch.zip on Github' > checksum.txt
26
+ shasum Branch.zip >> checksum
27
+ - name : Upload build artifacts
28
+ uses : actions/upload-artifact@v2
29
+ with :
30
+ name : Branch-xcframework
31
+ paths :
32
+ - carthage-build/Branch.zip
33
+ - carthage-build/checksum
34
+
35
+ build-static :
36
+ runs-on : macos-latest
37
+ steps :
38
+ - name : Check out code
39
+ uses : actions/checkout@v2
40
+ - name : Build static xcframework
41
+ working-directory : carthage-files
42
+ run : |
43
+ xcodebuild -scheme Branch-static-xcframework
44
+ cd build
45
+ zip -rqy Branch-static.zip Branch.xcframework/
46
+ echo '#checksum for Branch-static.zip on Github' > checksum.txt
47
+ shasum Branch_static.zip >> checksum_static
48
+ - name : Upload build artifacts
49
+ uses : actions/upload-artifact@v2
50
+ with :
51
+ name : Branch-static-xcframework
52
+ paths :
53
+ - carthage-build/Branch_static.zip
54
+ - carthage-build/checksum_static
55
+
12
56
release :
13
57
runs-on : macos-latest
58
+ needs : [build, build-static]
14
59
steps :
15
60
- name : Check out code
16
61
uses : actions/checkout@v2
17
62
- name : Set up Ruby 2.7
18
63
uses : ruby/setup-ruby@v1
19
64
with :
20
65
ruby-version : ' 2.7'
66
+ # The CocoaPods dependencies are only used by the
67
+ # Branch-TestBed.xcworkspace (for unit tests).
68
+ # Bring in the Ruby deps from the cache for quick availability of
69
+ # pod command. Not using cached Pods folder.
21
70
- name : Restore cache
22
71
uses : actions/cache@v2
23
72
with :
@@ -31,24 +80,48 @@ jobs:
31
80
run : |
32
81
bundle config set --local path vendor
33
82
bundle check || bundle install
34
- # This happens automatically with the unit_tests lane, but adding it here
35
- # makes it easier to keep track of installation time via GHA without
36
- # adding execution time to the next step.
37
- - name : Install CocoaPods dependencies
38
- run : bundle exec fastlane prepare_pods
39
-
40
- # 1. Publish to CocoaPods.
83
+ - name : Download build artifacts
84
+ uses : actions/download-artifact@v2
85
+ - name : Verify build artifacts
86
+ working-directory : carthage-files
87
+ run : |
88
+ ls -R
89
+ # The sha output from this step is the commit to be tagged.
90
+ - name : Commit checksums
91
+ id : commit-checksums
92
+ run : |
93
+ git config user.name "Branch SDK Team"
94
+ git config user.email [email protected]
95
+ git commit carthage-files/checksum carthage-files/checksum_static -m'Updated checksums'
96
+ echo "::set-output name=sha::$(git rev-parse HEAD)"
97
+ # TODO: Version bump along the way, probably here.
98
+ - name : Push changes
99
+ run : |
100
+ git push
41
101
- name : Publish to CocoaPods
42
102
run : |
103
+ # TODO: Authenticate
104
+ # bundle exec pod trunk push Branch.podspec
43
105
echo "TODO: This 👆"
44
- # 2. Create GitHub release. Also creates a tag.
45
- # Remember to build and attach binaries.
106
+ # 3. Create GitHub release. Also creates a tag.
46
107
- name : Create GitHub Release
47
108
uses : actions/github-script@v4
48
109
with :
49
110
script : |
50
- console.log('TODO: This 👆');
51
- # 3. Trigger import workflow in ios-spm repo.
111
+ const createRelease = require('./.github/custom-scripts/create-release');
112
+ const tagName = '${{ github.event.inputs.version }}';
113
+ const sha = '${{ steps.commit-checksums.outputs.sha }}';
114
+ const release = await createRelease({
115
+ core,
116
+ context,
117
+ github,
118
+ sha,
119
+ tagName,
120
+ });
121
+
122
+ console.log(`Created release ${tagName}:`);
123
+ console.log(` ${JSON.stringify(release)}`);
124
+ # 4. Trigger import workflow in ios-spm repo.
52
125
- name : Export to ios-spm repository
53
126
uses : actions/github-script@v4
54
127
with :
0 commit comments