-
Notifications
You must be signed in to change notification settings - Fork 22
357 lines (340 loc) · 13.8 KB
/
ddg-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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
name: Propagate Autoconsent To DDG Apps
on:
workflow_dispatch:
inputs:
tag_name:
description: 'The tag of the release to propagate'
required: true
env:
TAG: ${{ inputs.tag_name }}
RELEASE_NOTES: See release notes [here](https://github.com/duckduckgo/autoconsent/blob/${{ inputs.tag_name }}/CHANGELOG.md)
jobs:
# ------------------------------------------------------------------------------
# Retrieve the corresponding Release data from the GitHub API
# ------------------------------------------------------------------------------
get_release_info:
runs-on: ubuntu-latest
outputs:
release-url: ${{ steps.get-release-url.outputs.result }}
release-notes: ${{ steps.get-release-notes.outputs.result }}
steps:
- name: Get Release URL
id: get-release-url
uses: actions/github-script@v4
with:
result-encoding: string
script: |
const { data } = await github.repos.getReleaseByTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag: process.env.TAG
});
return data.html_url;
- name: Get Release Notes
id: get-release-notes
uses: actions/github-script@v4
with:
result-encoding: string
script: |
const { data } = await github.repos.getReleaseByTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag: process.env.TAG
});
return data.body;
# ------------------------------------------------------------------------------
# Create initial Asana subtasks
# ------------------------------------------------------------------------------
create_asana_tasks:
needs: get_release_info
runs-on: ubuntu-latest
outputs:
asana-output: ${{ steps.create-asana-tasks.outputs.ASANA_OUTPUT }}
env:
RELEASE_URL: ${{ needs.get_release_info.outputs.release-url }}
steps:
# --- Setup ---
- uses: actions/checkout@v3
with:
path: autoconsent/
- uses: ./autoconsent/.github/actions/setup-release-scripts
# --- Effect ---
- name: Create Asana Tasks
id: create-asana-tasks
env:
ASANA_ACCESS_TOKEN: ${{ secrets.ASANA_ACCESS_TOKEN }}
run: |
JSON_STRING="$(node ./autoconsent/ci/asana-create-tasks.js)"
echo "ASANA_OUTPUT=$JSON_STRING" >> $GITHUB_OUTPUT
# ------------------------------------------------------------------------------
# Create PR with updated autoconsent on Android
# ------------------------------------------------------------------------------
# update_android:
# runs-on: ubuntu-latest
# outputs:
# pull-request-url: ${{ steps.create-pr.outputs.pull-request-url }}
# needs:
# - create_asana_tasks
# - get_release_info
# env:
# RELEASE_URL: ${{ needs.get_release_info.outputs.release-url }}
# steps:
# # --- Setup ---
# - uses: actions/checkout@v3
# with:
# path: autoconsent/
# - uses: ./autoconsent/.github/actions/setup-release-scripts
# # --- Action ---
# - name: Checkout Android
# uses: actions/checkout@v3
# with:
# repository: duckduckgo/android
# path: android/
# token: ${{ secrets.DAX_WEB_AUTOFILL_AUTOMATION }}
# - uses: actions/setup-node@v3
# with:
# node-version: current
# - name: Update Android autoconsent reference
# run: |
# cd android
# npm install @duckduckgo/autoconsent@${{ env.TAG }}
# npm run rebuild-autoconsent
# cd ..
# - name: Create Android PR Body
# env:
# ASANA_OUTPUT: ${{ needs.create_asana_tasks.outputs.asana-output }}
# run: |
# TEMPLATE="$(node ./autoconsent/ci/create-pr-template.js android)"
# # Creates a randomised delimiter. See https://app.asana.com/0/1199892415909552/1203243297643584/f
# DELIMITER=$(echo $RANDOM | md5sum | head -c 20;)
# echo "PR_BODY_ANDROID<<$DELIMITER" >> $GITHUB_ENV
# echo "$TEMPLATE" >> $GITHUB_ENV
# echo "$DELIMITER" >> $GITHUB_ENV
# # --- Effect ---
# - name: Create PR for Android
# uses: peter-evans/create-pull-request@88bf0de51c7487d91e1abbb4899332e602c58bbf
# id: create-pr
# with:
# path: android/
# add-paths: |
# package.json
# package-lock.json
# autoconsent/
# commit-message: Update autoconsent to ${{ env.TAG }}
# branch: update-autoconsent-${{ env.TAG }}
# title: Update autoconsent to ${{ env.TAG }}
# body: "${{ env.PR_BODY_ANDROID }}"
# token: ${{ secrets.DAX_WEB_AUTOFILL_AUTOMATION }}
# # ------------------------------------------------------------------------------
# # Create PR with updated autoconsent on iOS
# # ------------------------------------------------------------------------------
# update_ios:
# runs-on: ubuntu-latest
# outputs:
# pull-request-url: ${{ steps.create-pr.outputs.pull-request-url }}
# needs:
# - create_asana_tasks
# - get_release_info
# env:
# RELEASE_URL: ${{ needs.get_release_info.outputs.release-url }}
# steps:
# # --- Setup ---
# - uses: actions/checkout@v3
# with:
# path: autoconsent/
# - uses: ./autoconsent/.github/actions/setup-release-scripts
# # --- Action ---
# - name: Checkout iOS
# uses: actions/checkout@v3
# with:
# repository: duckduckgo/iOS
# path: ios/
# token: ${{ secrets.DAX_WEB_AUTOFILL_AUTOMATION }}
# - uses: actions/setup-node@v3
# with:
# node-version: current
# - name: Update iOS autoconsent reference
# run: |
# cd ios
# npm install @duckduckgo/autoconsent@${{ env.TAG }}
# npm run rebuild-autoconsent
# cd ..
# - name: Create iOS PR Body
# env:
# ASANA_OUTPUT: ${{ needs.create_asana_tasks.outputs.asana-output }}
# run: |
# TEMPLATE="$(node ./autoconsent/ci/create-pr-template.js ios)"
# # Creates a randomised delimiter. See https://app.asana.com/0/1199892415909552/1203243297643584/f
# DELIMITER=$(echo $RANDOM | md5sum | head -c 20;)
# echo "PR_BODY_IOS<<$DELIMITER" >> $GITHUB_ENV
# echo "$TEMPLATE" >> $GITHUB_ENV
# echo "$DELIMITER" >> $GITHUB_ENV
# # --- Effect ---
# - name: Create PR for iOS
# uses: peter-evans/create-pull-request@88bf0de51c7487d91e1abbb4899332e602c58bbf
# id: create-pr
# with:
# path: ios/
# add-paths: |
# package.json
# package-lock.json
# DuckDuckGo/Autoconsent/
# commit-message: Update autoconsent to ${{ env.TAG }}
# branch: update-autoconsent-${{ env.TAG }}
# title: Update autoconsent to ${{ env.TAG }}
# body: "${{ env.PR_BODY_IOS }}"
# token: ${{ secrets.DAX_WEB_AUTOFILL_AUTOMATION }}
# # ------------------------------------------------------------------------------
# # Create PR with updated autoconsent on macOS
# # ------------------------------------------------------------------------------
# update_macos:
# runs-on: ubuntu-latest
# outputs:
# pull-request-url: ${{ steps.create-pr.outputs.pull-request-url }}
# needs:
# - create_asana_tasks
# - get_release_info
# env:
# RELEASE_URL: ${{ needs.get_release_info.outputs.release-url }}
# steps:
# # --- Setup ---
# - uses: actions/checkout@v3
# with:
# path: autoconsent/
# - uses: ./autoconsent/.github/actions/setup-release-scripts
# # --- Action ---
# - name: Checkout macOS
# uses: actions/checkout@v3
# with:
# repository: duckduckgo/macos-browser
# path: macos/
# token: ${{ secrets.DAX_WEB_AUTOFILL_AUTOMATION }}
# - uses: actions/setup-node@v3
# with:
# node-version: current
# - name: Update macOS autoconsent reference
# run: |
# cd macos
# npm install @duckduckgo/autoconsent@${{ env.TAG }}
# npm run rebuild-autoconsent
# cd ..
# - name: Create macOS PR Body
# env:
# ASANA_OUTPUT: ${{ needs.create_asana_tasks.outputs.asana-output }}
# run: |
# TEMPLATE="$(node ./autoconsent/ci/create-pr-template.js macos)"
# # Creates a randomised delimiter. See https://app.asana.com/0/1199892415909552/1203243297643584/f
# DELIMITER=$(echo $RANDOM | md5sum | head -c 20;)
# echo "PR_BODY_MACOS<<$DELIMITER" >> $GITHUB_ENV
# echo "$TEMPLATE" >> $GITHUB_ENV
# echo "$DELIMITER" >> $GITHUB_ENV
# # --- Effect ---
# - name: Create PR for macOS
# uses: peter-evans/create-pull-request@88bf0de51c7487d91e1abbb4899332e602c58bbf
# id: create-pr
# with:
# path: macos/
# add-paths: |
# package.json
# package-lock.json
# DuckDuckGo/Autoconsent/
# commit-message: Update autoconsent to ${{ env.TAG }}
# branch: update-autoconsent-${{ env.TAG }}
# title: Update autoconsent to ${{ env.TAG }}
# body: "${{ env.PR_BODY_MACOS }}"
# token: ${{ secrets.DAX_WEB_AUTOFILL_AUTOMATION }}
# # ------------------------------------------------------------------------------
# # Create PR with updated autofill on Windows
# # ------------------------------------------------------------------------------
# update_windows:
# runs-on: ubuntu-latest
# outputs:
# pull-request-url: ${{ steps.create-pr.outputs.pull-request-url }}
# needs:
# - create_asana_tasks
# - get_release_info
# env:
# RELEASE_URL: ${{ needs.get_release_info.outputs.release-url }}
# steps:
# # --- Setup ---
# - uses: actions/checkout@v3
# with:
# path: autoconsent/
# - uses: ./autoconsent/.github/actions/setup-release-scripts
# # --- Action ---
# - name: Checkout Windows
# uses: actions/checkout@v3
# with:
# repository: duckduckgo/windows-browser
# path: windows/
# token: ${{ secrets.DAX_WEB_AUTOFILL_AUTOMATION }}
# - uses: actions/setup-node@v3
# with:
# node-version: current
# - name: Update Windows autoconsent reference
# run: |
# cd windows/WindowsBrowser/Application/Autoconsent/External
# npm install @duckduckgo/autoconsent@${{ env.TAG }}
# npm run rebuild-autoconsent
# cd ../../../../../
# - name: Create Windows PR Body
# env:
# ASANA_OUTPUT: ${{ needs.create_asana_tasks.outputs.asana-output }}
# run: |
# TEMPLATE="$(node ./autoconsent/ci/create-pr-template.js windows)"
# # Creates a randomised delimiter. See https://app.asana.com/0/1199892415909552/1203243297643584/f
# DELIMITER=$(echo $RANDOM | md5sum | head -c 20;)
# echo "PR_BODY_WINDOWS<<$DELIMITER" >> $GITHUB_ENV
# echo "$TEMPLATE" >> $GITHUB_ENV
# echo "$DELIMITER" >> $GITHUB_ENV
# # --- Effect ---
# - name: Create PR for Windows
# uses: peter-evans/create-pull-request@88bf0de51c7487d91e1abbb4899332e602c58bbf
# id: create-pr
# with:
# path: windows/
# add-paths: |
# WindowsBrowser/Application/Autoconsent/
# commit-message: Update autoconsent to ${{ env.TAG }}
# branch: update-autoconsent-${{ env.TAG }}
# title: Update autoconsent to ${{ env.TAG }}
# body: "${{ env.PR_BODY_WINDOWS }}"
# token: ${{ secrets.DAX_WEB_AUTOFILL_AUTOMATION }}
# # ------------------------------------------------------------------------------
# # Update Asana subtasks with PR URLs
# # ------------------------------------------------------------------------------
# update_asana_tasks:
# runs-on: ubuntu-latest
# # Always run this final step, even if any of the updates have failed
# # unless the previous jobs were cancelled
# if: ${{ always() && !contains(needs.*.result, 'cancelled') }}
# needs: [create_asana_tasks, update_android, update_ios, update_macos, update_windows]
# steps:
# # --- Setup ---
# - uses: actions/checkout@v3
# with:
# path: autoconsent/
# - uses: ./autoconsent/.github/actions/setup-release-scripts
# # --- Effect ---
# - name: Update Asana tasks
# env:
# ASANA_ACCESS_TOKEN: ${{ secrets.ASANA_ACCESS_TOKEN }}
# ASANA_OUTPUT: ${{ needs.create_asana_tasks.outputs.asana-output }}
# IOS_PR_URL: ${{ needs.update_ios.outputs.pull-request-url }}
# MACOS_PR_URL: ${{ needs.update_macos.outputs.pull-request-url }}
# WINDOWS_PR_URL: ${{ needs.update_windows.outputs.pull-request-url }}
# ANDROID_PR_URL: ${{ needs.update_android.outputs.pull-request-url }}
# run: |
# node ./autoconsent/ci/asana-update-tasks.js
# - name: Ouput workflow summary
# # Show failure message if any of the jobs report failed
# if: ${{ contains(needs.*.result, 'failure') }}
# run: |
# echo "Release process completed but with failures reported." >> $GITHUB_STEP_SUMMARY
# echo "Please review the job output to see which steps require manual intervention." >> $GITHUB_STEP_SUMMARY
# - name: Ouput workflow summary
# # Show success message as long as none of the jobs report failed
# if: ${{ !contains(needs.*.result, 'failure') }}
# run: |
# echo "Release process completed successfully." >> $GITHUB_STEP_SUMMARY
# echo "All PRs and Asana tasks created! :rocket:" >> $GITHUB_STEP_SUMMARY