Skip to content

Workflow file for this run

name: Autofill Release Workflow
on:
release:
types: [ created ]
env:
VERSION: ${{ github.event.release.tag_name }}
RELEASE_URL: ${{ github.event.release.html_url }}
RELEASE_NOTES: ${{ github.event.release.body }}
jobs:
# ------------------------------------------------------------------------------
# Create initial Asana subtasks
# ------------------------------------------------------------------------------
create_asana_tasks:
runs-on: ubuntu-20.04
outputs:
asana-output: ${{ steps.create-asana-tasks.outputs.ASANA_OUTPUT }}
steps:
# --- Setup ---
- uses: actions/checkout@v3
with:
path: autofill/
- uses: ./autofill/.github/actions/setup-release-scripts
# --- Effect ---
- name: Create Asana Tasks
id: create-asana-tasks
env:
ASANA_ACCESS_TOKEN: ${{ secrets.NATIVE_APPS_WORKFLOW }}
run: |
JSON_STRING="$(node ./autofill/scripts/release/asana-create-tasks.js)"
echo "ASANA_OUTPUT=$JSON_STRING" >> $GITHUB_OUTPUT
# ------------------------------------------------------------------------------
# Create PR with updated autofill on Android
# ------------------------------------------------------------------------------
update_android:
runs-on: ubuntu-20.04
outputs:
pull-request-url: ${{ steps.create-pr.outputs.pull-request-url }}
needs: create_asana_tasks
steps:
# --- Setup ---
- uses: actions/checkout@v3
with:
path: autofill/
- uses: ./autofill/.github/actions/setup-release-scripts
# --- Action ---
- name: Checkout Android
uses: actions/checkout@v3
with:
repository: duckduckgo/android
path: android/
ref: develop
token: ${{ secrets.DAXMOBILE_AUTOFILL_AUTOMATION }}
- uses: actions/setup-node@v3
with:
node-version: current
- name: Update Android autofill reference
run: |
cd android
npm install github:duckduckgo/duckduckgo-autofill#${{ github.event.release.tag_name }}
cd ..
- name: Create Android PR Body
env:
ASANA_OUTPUT: ${{ needs.create_asana_tasks.outputs.asana-output }}
run: |
TEMPLATE="$(node ./autofill/scripts/release/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
node_modules/@duckduckgo/autofill
commit-message: Update autofill to ${{ github.event.release.tag_name }}
branch: update-autofill-${{ github.event.release.tag_name }}
title: Update autofill to ${{ github.event.release.tag_name }}
body: "${{ env.PR_BODY_ANDROID }}"
token: ${{ secrets.DAXMOBILE_AUTOFILL_AUTOMATION }}
# ------------------------------------------------------------------------------
# Create PR with updated autofill on BrowserServicesKit
# ------------------------------------------------------------------------------
update_bsk:
runs-on: ubuntu-20.04
outputs:
pull-request-url: ${{ steps.create-pr.outputs.pull-request-url }}
pull-request-head-sha: ${{ steps.create-pr.outputs.pull-request-head-sha }}
needs: create_asana_tasks
steps:
# --- Setup ---
- uses: actions/checkout@v3
with:
path: autofill/
- uses: ./autofill/.github/actions/setup-release-scripts
# --- Action ---
- name: Checkout BSK
uses: actions/checkout@v3
with:
repository: duckduckgo/BrowserServicesKit
path: bsk/
ref: main
token: ${{ secrets.DAXMOBILE_AUTOFILL_AUTOMATION }}
- name: Update BSK autofill reference
run: |
node ./autofill/scripts/release/update-bsk-repo.js
- name: Create BSK PR Body
env:
ASANA_OUTPUT: ${{ needs.create_asana_tasks.outputs.asana-output }}
run: |
TEMPLATE="$(node ./autofill/scripts/release/create-pr-template.js bsk)"
# Creates a randomised delimiter. See https://app.asana.com/0/1199892415909552/1203243297643584/f
DELIMITER=$(echo $RANDOM | md5sum | head -c 20;)
echo "PR_BODY_BSK<<$DELIMITER" >> $GITHUB_ENV
echo "$TEMPLATE" >> $GITHUB_ENV
echo "$DELIMITER" >> $GITHUB_ENV
# --- Effect ---
- name: Create PR for BSK
uses: peter-evans/create-pull-request@88bf0de51c7487d91e1abbb4899332e602c58bbf
id: create-pr
with:
path: bsk/
add-paths: Package.swift,Package.resolved
commit-message: Update autofill to ${{ github.event.release.tag_name }}
branch: update-autofill-${{ github.event.release.tag_name }}
title: Update autofill to ${{ github.event.release.tag_name }}
body: ${{ env.PR_BODY_BSK }}
token: ${{ secrets.DAXMOBILE_AUTOFILL_AUTOMATION }}
# ------------------------------------------------------------------------------
# Create PR with updated BrowserServicesKit on iOS
# ------------------------------------------------------------------------------
update_ios:
runs-on: ubuntu-20.04
outputs:
pull-request-url: ${{ steps.create-pr.outputs.pull-request-url }}
needs: [create_asana_tasks, update_bsk]
steps:
# --- Setup ---
- uses: actions/checkout@v3
with:
path: autofill/
- uses: ./autofill/.github/actions/setup-release-scripts
# --- Action ---
- name: Checkout iOS
uses: actions/checkout@v3
with:
repository: duckduckgo/iOS
path: ios/
ref: develop
token: ${{ secrets.DAXMOBILE_AUTOFILL_AUTOMATION }}
- name: Update iOS autofill reference
env:
BSK_SHA: ${{ needs.update_bsk.outputs.pull-request-head-sha }}
run: |
node ./autofill/scripts/release/update-apple-device-repo.js 'ios'
- name: Create iOS PR Body
env:
ASANA_OUTPUT: ${{ needs.create_asana_tasks.outputs.asana-output }}
BSK_PR_URL: ${{ needs.update_bsk.outputs.pull-request-url }}
run: |
TEMPLATE="$(node ./autofill/scripts/release/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: DuckDuckGo.xcodeproj/project.pbxproj
commit-message: Update BSK with autofill ${{ github.event.release.tag_name }}
branch: update-bsk-with-autofill-${{ github.event.release.tag_name }}
title: Update BSK with autofill ${{ github.event.release.tag_name }}
body: ${{ env.PR_BODY_IOS }}
token: ${{ secrets.DAXMOBILE_AUTOFILL_AUTOMATION }}
# ------------------------------------------------------------------------------
# Create PR with updated BrowserServicesKit on macOS
# ------------------------------------------------------------------------------
update_macos:
runs-on: ubuntu-20.04
outputs:
pull-request-url: ${{ steps.create-pr.outputs.pull-request-url }}
needs: [create_asana_tasks, update_bsk]
steps:
# --- Setup ---
- uses: actions/checkout@v3
with:
path: autofill/
- uses: ./autofill/.github/actions/setup-release-scripts
# --- Action ---
- name: Checkout macOS
uses: actions/checkout@v3
with:
repository: duckduckgo/macos-browser
path: macos/
ref: develop
token: ${{ secrets.DAXMOBILE_AUTOFILL_AUTOMATION }}
- name: Update macOS autofill reference
env:
BSK_SHA: ${{ needs.update_bsk.outputs.pull-request-head-sha }}
run: |
node ./autofill/scripts/release/update-apple-device-repo.js 'macos'
- name: Create macOS PR Body
env:
ASANA_OUTPUT: ${{ needs.create_asana_tasks.outputs.asana-output }}
BSK_PR_URL: ${{ needs.update_bsk.outputs.pull-request-url }}
run: |
TEMPLATE="$(node ./autofill/scripts/release/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: DuckDuckGo.xcodeproj/project.pbxproj
commit-message: Update BSK with autofill ${{ github.event.release.tag_name }}
branch: update-bsk-with-autofill-${{ github.event.release.tag_name }}
title: Update BSK with autofill ${{ github.event.release.tag_name }}
body: ${{ env.PR_BODY_MACOS }}
token: ${{ secrets.DAXMOBILE_AUTOFILL_AUTOMATION }}
# ------------------------------------------------------------------------------
# Create PR with updated autofill on Browser extensions
# ------------------------------------------------------------------------------
update_extensions:
runs-on: ubuntu-20.04
outputs:
pull-request-url: ${{ steps.create-pr.outputs.pull-request-url }}
needs: create_asana_tasks
steps:
# --- Setup ---
- uses: actions/checkout@v3
with:
path: autofill/
- uses: ./autofill/.github/actions/setup-release-scripts
# --- Action ---
- name: Checkout Extensions
uses: actions/checkout@v3
with:
repository: duckduckgo/duckduckgo-privacy-extension
path: extensions/
ref: main
token: ${{ secrets.DAXMOBILE_AUTOFILL_AUTOMATION }}
- uses: actions/setup-node@v3
with:
node-version-file: 'extensions/.nvmrc'
- name: Update Extensions autofill reference
run: |
cd extensions
npm install github:duckduckgo/duckduckgo-autofill#${{ github.event.release.tag_name }}
cd ..
- name: Create Extensions PR Body
env:
ASANA_OUTPUT: ${{ needs.create_asana_tasks.outputs.asana-output }}
run: |
TEMPLATE="$(node ./autofill/scripts/release/create-pr-template.js extensions)"
# Creates a randomised delimiter. See https://app.asana.com/0/1199892415909552/1203243297643584/f
DELIMITER=$(echo $RANDOM | md5sum | head -c 20;)
echo "PR_BODY_EXTENSIONS<<$DELIMITER" >> $GITHUB_ENV
echo "$TEMPLATE" >> $GITHUB_ENV
echo "$DELIMITER" >> $GITHUB_ENV
# --- Effect ---
- name: Create PR for Extensions
uses: peter-evans/create-pull-request@88bf0de51c7487d91e1abbb4899332e602c58bbf
id: create-pr
with:
path: extensions/
add-paths: |
package.json
package-lock.json
commit-message: Update autofill to ${{ github.event.release.tag_name }}
branch: update-autofill-${{ github.event.release.tag_name }}
title: Update autofill to ${{ github.event.release.tag_name }}
body: "${{ env.PR_BODY_EXTENSIONS }}"
token: ${{ secrets.DAXMOBILE_AUTOFILL_AUTOMATION }}
# ------------------------------------------------------------------------------
# Create PR with updated autofill on Windows
# ------------------------------------------------------------------------------
update_windows:
runs-on: ubuntu-20.04
outputs:
pull-request-url: ${{ steps.create-pr.outputs.pull-request-url }}
needs: create_asana_tasks
steps:
# --- Setup ---
- uses: actions/checkout@v3
with:
path: autofill/
- uses: ./autofill/.github/actions/setup-release-scripts
# --- Action ---
- name: Checkout Windows
uses: actions/checkout@v3
with:
repository: duckduckgo/windows-browser
path: windows/
ref: develop
submodules: true
token: ${{ secrets.DAXMOBILE_AUTOFILL_AUTOMATION }}
- name: Update Windows autofill reference
run: |
cd windows/submodules/duckduckgo-autofill
git fetch --tags
git checkout ${{ github.event.release.tag_name }}
cd ../../../
- name: Create Windows PR Body
env:
ASANA_OUTPUT: ${{ needs.create_asana_tasks.outputs.asana-output }}
run: |
TEMPLATE="$(node ./autofill/scripts/release/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: |
submodules/duckduckgo-autofill
commit-message: Update autofill to ${{ github.event.release.tag_name }}
branch: update-autofill-${{ github.event.release.tag_name }}
title: Update autofill to ${{ github.event.release.tag_name }}
body: "${{ env.PR_BODY_WINDOWS }}"
token: ${{ secrets.DAXMOBILE_AUTOFILL_AUTOMATION }}
# ------------------------------------------------------------------------------
# Update Asana subtasks with PR URLs
# ------------------------------------------------------------------------------
update_asana_tasks:
runs-on: ubuntu-20.04
# 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_bsk, update_ios, update_macos, update_android, update_extensions, update_windows]
steps:
# --- Setup ---
- uses: actions/checkout@v3
with:
path: autofill/
- uses: ./autofill/.github/actions/setup-release-scripts
# --- Effect ---
- name: Update Asana tasks
env:
ASANA_ACCESS_TOKEN: ${{ secrets.NATIVE_APPS_WORKFLOW }}
ASANA_OUTPUT: ${{ needs.create_asana_tasks.outputs.asana-output }}
BSK_PR_URL: ${{ needs.update_bsk.outputs.pull-request-url }}
IOS_PR_URL: ${{ needs.update_ios.outputs.pull-request-url }}
MACOS_PR_URL: ${{ needs.update_macos.outputs.pull-request-url }}
ANDROID_PR_URL: ${{ needs.update_android.outputs.pull-request-url }}
WINDOWS_PR_URL: ${{ needs.update_windows.outputs.pull-request-url }}
run: |
node ./autofill/scripts/release/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