1
+ name : Release WebRTC [86, 87, 88, 89, 90, 91]
2
+
3
+ on :
4
+ workflow_dispatch :
5
+
6
+ env :
7
+ current_release_milestone :
8
+ current_release_branch :
9
+ next_release_milestone :
10
+ next_release_branch :
11
+ should_build : ${{ false }}
12
+ output_name :
13
+ next_release_tag :
14
+ next_release_name :
15
+
16
+ output_dir : " ./out"
17
+
18
+ IOS_32_BIT : ${{ true }}
19
+ ENABLE_IOS_BITCODE : ${{ true }}
20
+
21
+ jobs :
22
+
23
+ build :
24
+ runs-on : macos-latest
25
+
26
+ strategy :
27
+ matrix :
28
+ milestone : [86, 87, 88, 89, 90, 91]
29
+
30
+ steps :
31
+ - uses : actions/checkout@v2
32
+
33
+ - name : GH Auth
34
+ run : |
35
+ echo ${{ secrets.GITHUB_TOKEN }} >> token.txt
36
+ gh auth login --with-token < token.txt
37
+ rm token.txt
38
+
39
+ - name : Getting WebRTC release
40
+ run : |
41
+ IFS=$'.' current_release_tag=($(gh api repos/${{ github.repository }}/releases | jq -r ".[0].tag_name"))
42
+ milestones=$( curl -sL "https://chromiumdash.appspot.com/fetch_milestones?mstone=${{ matrix.milestone }}")
43
+ echo "current_release_milestone=${current_release_tag[0]:-0}" >> $GITHUB_ENV
44
+ echo "current_release_branch=${current_release_tag[1]:-0}" >> $GITHUB_ENV
45
+ echo "next_release_milestone=$(echo $milestones | jq -r ".[0].milestone")" >> $GITHUB_ENV
46
+ echo "next_release_branch=$(echo $milestones | jq -r ".[0].webrtc_branch")" >> $GITHUB_ENV
47
+
48
+
49
+ - name : Setup enviroment
50
+ run : |
51
+ echo "should_build=${{ env.next_release_branch > env.current_release_branch }}" >> $GITHUB_ENV
52
+ echo "output_name=WebRTC-M${{ env.next_release_milestone }}.xcframework.zip" >> $GITHUB_ENV
53
+ echo "next_release_name=M${{ env.next_release_milestone }}" >> $GITHUB_ENV
54
+ echo "next_release_tag=${{ env.next_release_milestone }}.${{ env.next_release_branch }}.0" >> $GITHUB_ENV
55
+
56
+
57
+ - name : Create branch
58
+ if : env.should_build == 'true'
59
+ run : |
60
+ git config --local user.email "${{ github.actor }}[bot]@users.noreply.github.com"
61
+ git config --local user.name "github-actions[bot]"
62
+
63
+ git branch M${{ env.next_release_milestone }} -f
64
+ git checkout M${{ env.next_release_milestone }}
65
+
66
+ remote_repo="https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git"
67
+
68
+ git push "${remote_repo}" "M${{ env.next_release_milestone }}" --force --follow-tags --tags
69
+
70
+ mkdir "${{ env.output_dir }}"
71
+
72
+
73
+ - name : Checkout WebRTC
74
+ if : env.should_build == 'true'
75
+ run : |
76
+ source "${GITHUB_WORKSPACE}/scripts/checkout_webrtc.sh";
77
+ echo "${PATH}" >> $GITHUB_PATH
78
+ echo ::set-output name=should_build::false
79
+ env :
80
+ WEBRTC_BRANCH : ${{ env.next_release_branch }}
81
+
82
+ - name : Build ios x86 simulator
83
+ if : env.should_build == 'true' && env.IOS_32_BIT == 'true'
84
+ run : |
85
+ cd src
86
+ source "${GITHUB_WORKSPACE}/scripts/build_webrtc.sh"
87
+ env :
88
+ TARGET_OS : " ios"
89
+ TARGET_CPU : " x86"
90
+ ENVIROMENT : " simulator"
91
+
92
+ - name : Build ios x64 simulator
93
+ if : env.should_build == 'true'
94
+ run : |
95
+ cd src
96
+ source "${GITHUB_WORKSPACE}/scripts/build_webrtc.sh"
97
+ env :
98
+ TARGET_OS : " ios"
99
+ TARGET_CPU : " x64"
100
+ ENVIROMENT : " simulator"
101
+
102
+ - name : Build ios arm64 simulator
103
+ if : env.should_build == 'true'
104
+ run : |
105
+ cd src
106
+ source "${GITHUB_WORKSPACE}/scripts/build_webrtc.sh"
107
+ env :
108
+ TARGET_OS : " ios"
109
+ TARGET_CPU : " arm64"
110
+ ENVIROMENT : " simulator"
111
+
112
+ - name : Build ios arm device
113
+ if : env.should_build == 'true' && env.IOS_32_BIT == 'true'
114
+ run : |
115
+ cd src
116
+ source "${GITHUB_WORKSPACE}/scripts/build_webrtc.sh"
117
+ env :
118
+ TARGET_OS : " ios"
119
+ TARGET_CPU : " arm"
120
+ ENVIROMENT : " device"
121
+
122
+ - name : Build ios arm64 device
123
+ if : env.should_build == 'true'
124
+ run : |
125
+ cd src
126
+ source "${GITHUB_WORKSPACE}/scripts/build_webrtc.sh"
127
+ env :
128
+ TARGET_OS : " ios"
129
+ TARGET_CPU : " arm64"
130
+ ENVIROMENT : " device"
131
+
132
+ - name : Build mac x64
133
+ if : env.should_build == 'true'
134
+ run : |
135
+ cd src
136
+ source "${GITHUB_WORKSPACE}/scripts/build_webrtc.sh"
137
+ env :
138
+ TARGET_OS : " mac"
139
+ TARGET_CPU : " x64"
140
+
141
+ - name : Build mac arm64
142
+ if : env.should_build == 'true'
143
+ run : |
144
+ cd src
145
+ source "${GITHUB_WORKSPACE}/scripts/build_webrtc.sh"
146
+ env :
147
+ TARGET_OS : " mac"
148
+ TARGET_CPU : " arm64"
149
+
150
+ - name : Create XCFramefork
151
+ id : create_xcframework
152
+ if : env.should_build == 'true'
153
+ run : |
154
+ source "${GITHUB_WORKSPACE}/scripts/create_xcframework.sh"
155
+ cd "${{ env.output_dir }}"
156
+ zip --symlinks -r ${{ env.output_name }} WebRTC.xcframework/
157
+ CHECKSUM=$(shasum -a 256 ${{ env.output_name }} | awk '{ print $1 }')
158
+
159
+ echo ::set-output name=checksum::$CHECKSUM
160
+ env :
161
+ XCFRAMEWORK_NAME : " WebRTC"
162
+ PLISTBUDDY : " /usr/libexec/PlistBuddy"
163
+
164
+ # - name: Test Create XCFramefork
165
+ # id: create_xcframework
166
+ # if: env.should_build == 'true'
167
+ # run: |
168
+ # echo "Test" >> "${{ env.output_dir }}/${{ env.output_name }}"
169
+ # CHECKSUM=$(shasum -a 256 "${{ env.output_dir }}/${{ env.output_name }}" | awk '{ print $1 }')
170
+ # echo ${CHECKSUM}
171
+ # echo ::set-output name=checksum::$CHECKSUM
172
+
173
+ - name : Update Package.swift
174
+ if : env.should_build == 'true'
175
+ run : |
176
+ sed -i '' -E 's,url:.*WebRTC-M[0-9]+.xcframework.zip,url: "https://github.com/${{ github.repository }}/releases/download/${{ env.next_release_tag }}/${{ env.output_name }},g' Package.swift
177
+ sed -i '' -E 's/checksum: .*/checksum: "${{ steps.create_xcframework.outputs.checksum }}"/g' Package.swift
178
+
179
+ - name : commit and push
180
+ if : env.should_build == 'true'
181
+ run : |
182
+ git add Package.swift
183
+ git commit -m "Update for release ${{ env.next_release_name }}"
184
+ git tag "${{ env.next_release_tag }}"
185
+
186
+ remote_repo="https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git"
187
+
188
+ git push "${remote_repo}" "M${{ env.next_release_milestone }}" --force --follow-tags --tags
189
+
190
+ - name : Create prerelease
191
+ if : env.should_build == 'true'
192
+ run : |
193
+ echo "Release notes: N/A\nWebRTC Branch: [branch-heads/${{ env.next_release_branch }}](https://chromium.googlesource.com/external/webrtc/+log/branch-heads/${{ env.next_release_branch }})" >> changelog.md
194
+ gh release create "${{ env.next_release_tag }}" -d -t "M${{ env.next_release_milestone }}" -F changelog.md "${{ env.output_dir }}/${{ env.output_name }}"
195
+
196
+ - name : Open PR
197
+ if : env.should_build == 'true'
198
+ run : gh pr create -f --head "M${{ env.next_release_milestone }}"
0 commit comments