diff --git a/.github/workflows/ddg-release.yml b/.github/workflows/ddg-release.yml index 2c8eb5b6..e59bb501 100644 --- a/.github/workflows/ddg-release.yml +++ b/.github/workflows/ddg-release.yml @@ -6,6 +6,53 @@ on: tag_name: description: 'The tag of the release to propagate' required: true + android: + description: 'Propagate to Android' + type: boolean + required: true + default: true + ios: + description: 'Propagate to iOS' + type: boolean + required: true + default: true + macos: + description: 'Propagate to macOS' + type: boolean + required: true + default: true + windows: + description: 'Propagate to Windows' + type: boolean + required: true + default: true + + workflow_call: + inputs: + tag_name: + type: string + description: 'The tag of the release to propagate' + required: true + android: + description: 'Propagate to Android' + type: boolean + required: true + default: true + ios: + description: 'Propagate to iOS' + type: boolean + required: true + default: true + macos: + description: 'Propagate to macOS' + type: boolean + required: true + default: true + windows: + description: 'Propagate to Windows' + type: boolean + required: true + default: true env: TAG: ${{ inputs.tag_name }} @@ -77,6 +124,7 @@ jobs: # ------------------------------------------------------------------------------ update_android: + if: ${{ inputs.android }} runs-on: ubuntu-latest outputs: pull-request-url: ${{ steps.create-pr.outputs.pull-request-url }} @@ -119,7 +167,7 @@ jobs: echo "$DELIMITER" >> $GITHUB_ENV # --- Effect --- - name: Create PR for Android - uses: peter-evans/create-pull-request@88bf0de51c7487d91e1abbb4899332e602c58bbf + uses: peter-evans/create-pull-request@v7 id: create-pr with: path: android/ @@ -128,7 +176,7 @@ jobs: package-lock.json autoconsent/ commit-message: Update autoconsent to ${{ env.TAG }} - branch: update-autoconsent-${{ env.TAG }} + branch: update-autoconsent title: Update autoconsent to ${{ env.TAG }} body: '${{ env.PR_BODY_ANDROID }}' token: ${{ secrets.DAX_WEB_AUTOFILL_AUTOMATION }} @@ -138,6 +186,7 @@ jobs: # ------------------------------------------------------------------------------ update_ios: + if: ${{ inputs.ios }} runs-on: ubuntu-latest outputs: pull-request-url: ${{ steps.create-pr.outputs.pull-request-url }} @@ -180,7 +229,7 @@ jobs: echo "$DELIMITER" >> $GITHUB_ENV # --- Effect --- - name: Create PR for iOS - uses: peter-evans/create-pull-request@88bf0de51c7487d91e1abbb4899332e602c58bbf + uses: peter-evans/create-pull-request@v7 id: create-pr with: path: ios/ @@ -189,7 +238,7 @@ jobs: package-lock.json DuckDuckGo/Autoconsent/ commit-message: Update autoconsent to ${{ env.TAG }} - branch: update-autoconsent-${{ env.TAG }} + branch: update-autoconsent title: Update autoconsent to ${{ env.TAG }} body: '${{ env.PR_BODY_IOS }}' token: ${{ secrets.DAX_WEB_AUTOFILL_AUTOMATION }} @@ -199,6 +248,7 @@ jobs: # ------------------------------------------------------------------------------ update_macos: + if: ${{ inputs.macos }} runs-on: ubuntu-latest outputs: pull-request-url: ${{ steps.create-pr.outputs.pull-request-url }} @@ -241,7 +291,7 @@ jobs: echo "$DELIMITER" >> $GITHUB_ENV # --- Effect --- - name: Create PR for macOS - uses: peter-evans/create-pull-request@88bf0de51c7487d91e1abbb4899332e602c58bbf + uses: peter-evans/create-pull-request@v7 id: create-pr with: path: macos/ @@ -250,7 +300,7 @@ jobs: package-lock.json DuckDuckGo/Autoconsent/ commit-message: Update autoconsent to ${{ env.TAG }} - branch: update-autoconsent-${{ env.TAG }} + branch: update-autoconsent title: Update autoconsent to ${{ env.TAG }} body: '${{ env.PR_BODY_MACOS }}' token: ${{ secrets.DAX_WEB_AUTOFILL_AUTOMATION }} @@ -260,6 +310,7 @@ jobs: # ------------------------------------------------------------------------------ update_windows: + if: ${{ inputs.windows }} runs-on: ubuntu-latest outputs: pull-request-url: ${{ steps.create-pr.outputs.pull-request-url }} @@ -302,14 +353,14 @@ jobs: echo "$DELIMITER" >> $GITHUB_ENV # --- Effect --- - name: Create PR for Windows - uses: peter-evans/create-pull-request@88bf0de51c7487d91e1abbb4899332e602c58bbf + uses: peter-evans/create-pull-request@v7 id: create-pr with: path: windows/ add-paths: | WindowsBrowser/Application/Autoconsent/ commit-message: Update autoconsent to ${{ env.TAG }} - branch: update-autoconsent-${{ env.TAG }} + branch: update-autoconsent title: Update autoconsent to ${{ env.TAG }} body: '${{ env.PR_BODY_WINDOWS }}' token: ${{ secrets.DAX_WEB_AUTOFILL_AUTOMATION }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 60ab9797..7ecf255f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,7 +8,9 @@ on: jobs: release: runs-on: ubuntu-latest - if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')" + if: ${{ !contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci') }} + outputs: + tag_name: ${{ steps.remember_tag.outputs.tag_name }} steps: - uses: actions/checkout@v3 @@ -33,3 +35,15 @@ jobs: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} run: | npm run release + + - name: Remember git tag + id: remember_tag + run: echo "tag_name=$(git describe --exact-match --tags)" >> "$GITHUB_OUTPUT" + + ddg-release: + name: Propagate to DDG apps + needs: release + if: ${{ !contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci') }} + uses: ./.github/workflows/ddg-release.yml + with: + tag_name: ${{ needs.release.outputs.tag_name }} diff --git a/ci/asana-update-tasks.js b/ci/asana-update-tasks.js index 75113503..267824e2 100644 --- a/ci/asana-update-tasks.js +++ b/ci/asana-update-tasks.js @@ -3,10 +3,10 @@ const { replaceAllInString, getLink } = require('./release-utils.js'); const ASANA_ACCESS_TOKEN = process.env.ASANA_ACCESS_TOKEN; const prUrls = { - android: process.env.ANDROID_PR_URL || 'https://example.com/', - ios: process.env.IOS_PR_URL || 'https://example.com/', - macos: process.env.MACOS_PR_URL || 'https://example.com/', - windows: process.env.WINDOWS_PR_URL || 'https://example.com/', + android: process.env.ANDROID_PR_URL, + ios: process.env.IOS_PR_URL, + macos: process.env.MACOS_PR_URL, + windows: process.env.WINDOWS_PR_URL, }; const asanaOutputRaw = process.env.ASANA_OUTPUT; @@ -34,7 +34,10 @@ const asanaUpdateTasks = async () => { for (const [platformName, platformObj] of platformEntries) { // If we're missing required data, either we haven't implemented automation for that platform yet, // or something went wrong in a previous job - if (!platformObj.taskGid || !prUrls[platformName]) continue; + if (!platformObj.taskGid || !prUrls[platformName]) { + console.error(`Skipping ${platformName} task update`); + continue; + } const { html_notes: notes } = await asana.tasks.getTask(platformObj.taskGid, { opt_fields: 'html_notes' });