Skip to content

Commit

Permalink
Migrate asana-extract-task-id GHA action to a fastlane plugin (#3145)
Browse files Browse the repository at this point in the history
Task/Issue URL: https://app.asana.com/0/1203301625297703/1208137627434482/f

**Description**:
This change introduces ddg_apple_automation fastlane plugin and its first action, for extracting task ID from Asana task URL. Fastlane setup step was added to all workflows, GHA action calls were replaced by fastlane action calls,
outputs were renamed to match action output name and old GHA action was removed.
  • Loading branch information
ayoy authored Aug 26, 2024
1 parent 15f4428 commit 081dfea
Show file tree
Hide file tree
Showing 14 changed files with 74 additions and 77 deletions.
8 changes: 3 additions & 5 deletions .github/actions/asana-add-comment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@ runs:
steps:
- id: extract-task-id
if: ${{ inputs.task-url }}
uses: ./.github/actions/asana-extract-task-id
with:
task-url: ${{ inputs.task-url }}
access-token: ${{ inputs.access-token }}
shell: bash
run: bundle exec fastlane run asana_extract_task_id task_url:"${{ inputs.task-url }}"

- id: process-template-payload
if: ${{ inputs.template-name }}
Expand Down Expand Up @@ -62,7 +60,7 @@ runs:
shell: bash
env:
ASANA_ACCESS_TOKEN: ${{ inputs.access-token }}
TASK_ID: ${{ inputs.task-id || steps.extract-task-id.outputs.task-id }}
TASK_ID: ${{ inputs.task-id || steps.extract-task-id.outputs.asana_task_id }}
PAYLOAD_BASE64: ${{ steps.process-template-payload.outputs.payload-base64 || steps.process-comment-payload.outputs.payload-base64 }}
run: |
return_code=$(curl -fLSs "https://app.asana.com/api/1.0/tasks/${TASK_ID}/stories" \
Expand Down
23 changes: 0 additions & 23 deletions .github/actions/asana-extract-task-id/action.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,18 @@ runs:
using: "composite"
steps:
- id: extract-task-id
uses: ./.github/actions/asana-extract-task-id
with:
task-url: ${{ inputs.task-url }}
access-token: ${{ inputs.access-token }}
shell: bash
run: bundle exec fastlane run asana_extract_task_id task_url:"${{ inputs.task-url }}"

- id: extract-assignee-id
uses: ./.github/actions/asana-extract-task-assignee
with:
task-id: ${{ steps.extract-task-id.outputs.task-id }}
task-id: ${{ steps.extract-task-id.outputs.asana_task_id }}
access-token: ${{ inputs.access-token }}

- id: extract-automation-task-id
run: |
task_id="${{ steps.extract-task-id.outputs.task-id }}"
task_id="${{ steps.extract-task-id.outputs.asana_task_id }}"
automation_task_id=$(curl -fLSs "https://app.asana.com/api/1.0/tasks/${task_id}/subtasks?opt_fields=name" \
-H "Authorization: Bearer ${{ inputs.access-token }}" \
| jq -r '.data[] | select(.name=="Automation").gid')
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build_appstore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ jobs:
submodules: recursive
ref: ${{ env.branch }}

- name: Set up fastlane
run: bundle install

- name: Check if this is an official release build
id: is-official-release
env:
Expand All @@ -102,9 +105,6 @@ jobs:
- name: Select Xcode
run: sudo xcode-select -s /Applications/Xcode_$(<.xcode-version).app/Contents/Developer

- name: Prepare fastlane
run: bundle install

- name: Archive and Upload the App
env:
APPLE_API_KEY_BASE64: ${{ secrets.APPLE_API_KEY_BASE64 }}
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/build_hotfix_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,12 @@ jobs:
ref: ${{ github.ref_name }}
submodules: recursive

- name: Set up fastlane
run: bundle install

- name: Extract Asana Task ID
id: task-id
uses: ./.github/actions/asana-extract-task-id
with:
task-url: ${{ github.event.inputs.asana-task-url }}
run: bundle exec fastlane run asana_extract_task_id task_url:"${{ github.event.inputs.asana-task-url }}"

- name: Update Asana tasks for the release
env:
Expand All @@ -101,7 +102,7 @@ jobs:
version="$(cut -d '/' -f 2 <<< "$BRANCH")"
# 'internal', because we start with making a build that still needs to be tested before being published
# and we want Asana tasks to be moved to "Validation" and not already to "Done"
./scripts/update_asana_for_release.sh internal ${{ steps.task-id.outputs.task-id }} ${{ vars.MACOS_APP_BOARD_VALIDATION_SECTION_ID }} "${version}"
./scripts/update_asana_for_release.sh internal ${{ steps.task-id.outputs.asana_task_id }} ${{ vars.MACOS_APP_BOARD_VALIDATION_SECTION_ID }} "${version}"
prepare_release:
name: Prepare Release
Expand Down
25 changes: 13 additions & 12 deletions .github/workflows/build_notarized.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ jobs:
submodules: recursive
ref: ${{ env.branch }}

- name: Set up fastlane
run: bundle install

- name: Check if this is an official release build
id: is-official-release
env:
Expand Down Expand Up @@ -222,13 +225,6 @@ jobs:
name: DuckDuckGo-${{ env.release-type }}-dSYM-${{ env.app-version }}
path: ${{ github.workspace }}/release/${{ steps.set-outputs.outputs.dsym-name }}

- name: Extract Asana Task ID
id: task-id
if: ${{ env.upload-to == 'asana' }}
uses: ./.github/actions/asana-extract-task-id
with:
task-url: ${{ env.asana-task-url }}

- name: Upload dSYMs to S3
id: upload-dsyms-to-s3
if: ${{ env.upload-to == 's3' }}
Expand Down Expand Up @@ -276,7 +272,14 @@ jobs:
with:
submodules: recursive
ref: ${{ inputs.branch || github.ref_name }}
sparse-checkout: .github
sparse-checkout: |
.github
Gemfile
Gemfile.lock
fastlane
- name: Set up fastlane
run: bundle install

- name: Fetch app bundle
uses: actions/download-artifact@v4
Expand Down Expand Up @@ -345,17 +348,15 @@ jobs:
- name: Extract Asana Task ID
id: task-id
if: ${{ env.upload-to == 'asana' }}
uses: ./.github/actions/asana-extract-task-id
with:
task-url: ${{ env.asana-task-url }}
run: bundle exec fastlane run asana_extract_task_id task_url:"${{ env.asana-task-url }}"

- name: Upload DMG to Asana
if: ${{ env.upload-to == 'asana' }}
uses: ./.github/actions/asana-upload
with:
access-token: ${{ secrets.ASANA_ACCESS_TOKEN }}
file-name: ${{ github.workspace }}/duckduckgo-${{ env.app-version }}.dmg
task-id: ${{ steps.task-id.outputs.task-id }}
task-id: ${{ steps.task-id.outputs.asana_task_id }}

mattermost:

Expand Down
18 changes: 10 additions & 8 deletions .github/workflows/bump_internal_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ jobs:
with:
fetch-depth: 0 # Fetch all history and tags in order to extract Asana task URLs from git log

- name: Set up fastlane
run: bundle install

# When running on schedule there are no inputs, so the workflow has to find the Asana task
- name: Find Asana release task
id: find-asana-task
Expand Down Expand Up @@ -89,16 +92,14 @@ jobs:
- name: Extract Asana Task ID
id: task-id
if: github.event.inputs.asana-task-url
uses: ./.github/actions/asana-extract-task-id
with:
task-url: ${{ github.event.inputs.asana-task-url }}
run: bundle exec fastlane run asana_extract_task_id task_url:"${{ github.event.inputs.asana-task-url }}"

- name: Set parameters
id: set-parameters
env:
ASANA_TASK_URL: ${{ steps.find-asana-task.outputs.task-url || github.event.inputs.asana-task-url }}
RELEASE_BRANCH: ${{ steps.find-asana-task.outputs.release-branch || github.ref_name }}
TASK_ID: ${{ steps.find-asana-task.outputs.task-id || steps.task-id.outputs.task-id }}
TASK_ID: ${{ steps.find-asana-task.outputs.task-id || steps.task-id.outputs.asana_task_id }}
SKIP_APPSTORE: ${{ github.event.inputs.skip-appstore || false }} # make sure this is set to false on scheduled runs
run: |
if [[ "${RELEASE_BRANCH}" == "main" ]]; then
Expand Down Expand Up @@ -181,6 +182,9 @@ jobs:
ref: ${{ needs.validate_input_conditions.outputs.release-branch }}
submodules: recursive

- name: Set up fastlane
run: bundle install

- name: Select Xcode
run: sudo xcode-select -s /Applications/Xcode_$(<.xcode-version).app/Contents/Developer

Expand All @@ -199,9 +203,7 @@ jobs:
- name: Extract Asana Task ID
id: task-id
uses: ./.github/actions/asana-extract-task-id
with:
task-url: ${{ needs.validate_input_conditions.outputs.asana-task-url }}
run: bundle exec fastlane run asana_extract_task_id task_url:"${{ needs.validate_input_conditions.outputs.asana-task-url }}"

- name: Update Asana tasks for the release
env:
Expand All @@ -210,7 +212,7 @@ jobs:
BRANCH: ${{ needs.validate_input_conditions.outputs.release-branch }}
run: |
version="$(cut -d '/' -f 2 <<< "$BRANCH")"
./scripts/update_asana_for_release.sh internal ${{ steps.task-id.outputs.task-id }} ${{ vars.MACOS_APP_BOARD_VALIDATION_SECTION_ID }} "${version}"
./scripts/update_asana_for_release.sh internal ${{ steps.task-id.outputs.asana_task_id }} ${{ vars.MACOS_APP_BOARD_VALIDATION_SECTION_ID }} "${version}"
prepare_release:
name: Prepare Release
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/hotfix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
submodules: recursive
fetch-depth: 0 # Fetch all history and tags in order to extract Asana task URLs from git log

- name: Prepare fastlane
- name: Set up fastlane
run: bundle install

- name: Make release branch
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/publish_dmg_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,18 +129,19 @@ jobs:
echo "::notice::Branch ${branch} doesn't exist on the remote repository, staying on main."
fi
- name: Set up fastlane
run: bundle install

- name: Select Xcode
run: sudo xcode-select -s /Applications/Xcode_$(<.xcode-version).app/Contents/Developer

- name: Extract Asana Task ID
id: task-id
uses: ./.github/actions/asana-extract-task-id
with:
task-url: ${{ env.asana-task-url }}
run: bundle exec fastlane run asana_extract_task_id task_url:"${{ env.asana-task-url }}"

- name: Fetch and validate release notes
env:
TASK_ID: ${{ steps.task-id.outputs.task-id }}
TASK_ID: ${{ steps.task-id.outputs.asana_task_id }}
ASANA_ACCESS_TOKEN: ${{ secrets.ASANA_ACCESS_TOKEN }}
run: |
curl -fLSs "https://app.asana.com/api/1.0/tasks/${TASK_ID}?opt_fields=notes" \
Expand Down Expand Up @@ -256,7 +257,7 @@ jobs:
run: |
version="$(cut -d '/' -f 2 <<< "$BRANCH")"
./scripts/update_asana_for_release.sh public \
${{ steps.task-id.outputs.task-id }} \
${{ steps.task-id.outputs.asana_task_id }} \
${{ vars.MACOS_APP_BOARD_DONE_SECTION_ID }} \
"${version}" \
announcement-task-contents.txt
Expand All @@ -281,7 +282,7 @@ jobs:
echo "DMG_URL=${{ vars.DMG_URL_ROOT }}${DMG_NAME}" >> $GITHUB_ENV
echo "RELEASE_BUCKET_NAME=${{ vars.RELEASE_BUCKET_NAME }}" >> $GITHUB_ENV
echo "RELEASE_BUCKET_PREFIX=${{ vars.RELEASE_BUCKET_PREFIX }}" >> $GITHUB_ENV
echo "RELEASE_TASK_ID=${{ steps.task-id.outputs.task-id }}" >> $GITHUB_ENV
echo "RELEASE_TASK_ID=${{ steps.task-id.outputs.asana_task_id }}" >> $GITHUB_ENV
echo "TASKS_SINCE_LAST_INTERNAL_RELEASE=${{ steps.get-tasks-since-last-internal-release.outputs.tasks }}" >> $GITHUB_ENV
echo "VERSION=${{ steps.verify-tag.outputs.release-version }}" >> $GITHUB_ENV
echo "WORKFLOW_URL=https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> $GITHUB_ENV
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/tag_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ jobs:
submodules: recursive
ref: ${{ env.BRANCH }}

- name: Set up fastlane
run: bundle install

- name: Create Tag and GitHub Release
id: create-tag
uses: ./.github/actions/create-tag-and-github-release
Expand Down
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ source 'https://rubygems.org'

gem 'fastlane', '2.222.0'
gem 'httparty'

plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
eval_gemfile(plugins_path) if File.exist?(plugins_path)
24 changes: 16 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
GIT
remote: https://github.com/duckduckgo/fastlane-plugin-ddg_apple_automation
revision: 766668da77fe379e9cae0ae183083ca82fe1b663
tag: 0.1.0
specs:
fastlane-plugin-ddg_apple_automation (0.1.0)

GEM
remote: https://rubygems.org/
specs:
Expand All @@ -10,20 +17,20 @@ GEM
artifactory (3.0.17)
atomos (0.1.3)
aws-eventstream (1.3.0)
aws-partitions (1.958.0)
aws-sdk-core (3.201.3)
aws-partitions (1.968.0)
aws-sdk-core (3.201.5)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.8)
aws-sigv4 (~> 1.9)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.88.0)
aws-sdk-core (~> 3, >= 3.201.0)
aws-sigv4 (~> 1.5)
aws-sdk-s3 (1.156.0)
aws-sdk-s3 (1.159.0)
aws-sdk-core (~> 3, >= 3.201.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.5)
aws-sigv4 (1.9.0)
aws-sigv4 (1.9.1)
aws-eventstream (~> 1, >= 1.0.2)
babosa (1.0.4)
base64 (0.2.0)
Expand Down Expand Up @@ -127,7 +134,7 @@ GEM
google-apis-core (>= 0.11.0, < 2.a)
google-apis-storage_v1 (0.31.0)
google-apis-core (>= 0.11.0, < 2.a)
google-cloud-core (1.7.0)
google-cloud-core (1.7.1)
google-cloud-env (>= 1.0, < 3.a)
google-cloud-errors (~> 1.0)
google-cloud-env (1.6.0)
Expand All @@ -148,7 +155,7 @@ GEM
os (>= 0.9, < 2.0)
signet (>= 0.16, < 2.a)
highline (2.0.3)
http-cookie (1.0.6)
http-cookie (1.0.7)
domain_name (~> 0.5)
httparty (0.22.0)
csv
Expand Down Expand Up @@ -220,7 +227,8 @@ PLATFORMS

DEPENDENCIES
fastlane (= 2.222.0)
fastlane-plugin-ddg_apple_automation!
httparty

BUNDLED WITH
2.3.26
2.4.19
2 changes: 1 addition & 1 deletion fastlane/Fastfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

opt_out_usage
fastlane_require 'httparty'
fastlane_require 'rexml/document'

Expand Down
5 changes: 5 additions & 0 deletions fastlane/Pluginfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Autogenerated by fastlane
#
# Ensure this file is checked in to source control!

gem 'fastlane-plugin-ddg_apple_automation', git: 'https://github.com/duckduckgo/fastlane-plugin-ddg_apple_automation', tag: '0.1.0'

0 comments on commit 081dfea

Please sign in to comment.