From ca548214b353dbc7aed24e0eb5a2cf96ac1d67b1 Mon Sep 17 00:00:00 2001 From: Alessandro Boron Date: Tue, 26 Mar 2024 18:53:18 +1100 Subject: [PATCH] Restore mattermost task in create_variants workflow --- .github/workflows/create_dmg_variant.yml | 38 ------------------------ .github/workflows/create_variants.yml | 37 +++++++++++++++++++++++ 2 files changed, 37 insertions(+), 38 deletions(-) diff --git a/.github/workflows/create_dmg_variant.yml b/.github/workflows/create_dmg_variant.yml index d4e612bde2..c36c291916 100644 --- a/.github/workflows/create_dmg_variant.yml +++ b/.github/workflows/create_dmg_variant.yml @@ -238,41 +238,3 @@ jobs: aws s3 cp duckduckgo.dmg \ s3://${{ vars.RELEASE_BUCKET_NAME }}/${{ vars.RELEASE_BUCKET_PREFIX }}/${{ steps.set-variant-name.outputs.variant-name }}/duckduckgo.dmg \ --acl public-read - - mattermost: - - name: Send Mattermost message - - needs: create-dmg-variant - - runs-on: ubuntu-latest - - env: - success: ${{ needs.create-dmg-variant.result == 'success' }} - failure: ${{ needs.create-dmg-variant.result == 'failure' }} - - steps: - - name: Send Mattermost message - if: ${{ env.success || env.failure }} # Don't execute when cancelled - env: - GH_TOKEN: ${{ github.token }} - WORKFLOW_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} - run: | - curl -fLSs $(gh api https://api.github.com/repos/${{ github.repository }}/contents/scripts/assets/variants-release-mm-template.json?ref=${{ github.ref }} --jq .download_url) \ - --output message-template.json - - export MM_USER_HANDLE=$(base64 -d <<< ${{ secrets.MM_HANDLES_BASE64 }} | jq ".${{ github.actor }}" | tr -d '"') - - if [[ -z "${MM_USER_HANDLE}" ]]; then - echo "Mattermost user handle not known for ${{ github.actor }}, skipping sending message" - else - - if [[ "${{ env.success }}" == "true" ]]; then - status="success" - else - status="failure" - fi - curl -s -H 'Content-type: application/json' \ - -d "$(envsubst < message-template.json | jq ".${status}")" \ - ${{ secrets.MM_WEBHOOK_URL }} - fi diff --git a/.github/workflows/create_variants.yml b/.github/workflows/create_variants.yml index dbd1fb8fe7..58db205092 100644 --- a/.github/workflows/create_variants.yml +++ b/.github/workflows/create_variants.yml @@ -115,3 +115,40 @@ jobs: MM_WEBHOOK_URL: ${{ secrets.MM_WEBHOOK_URL }} AWS_ACCESS_KEY_ID_RELEASE_S3: ${{ secrets.AWS_ACCESS_KEY_ID_RELEASE_S3 }} AWS_SECRET_ACCESS_KEY_RELEASE_S3: ${{ secrets.AWS_SECRET_ACCESS_KEY_RELEASE_S3 }} + + mattermost: + if: false + + name: Send Mattermost message + needs: create-variants + runs-on: ubuntu-latest + + env: + success: ${{ needs.create-variants.result == 'success' }} + failure: ${{ needs.create-variants.result == 'failure' }} + + steps: + - name: Send Mattermost message + if: ${{ env.success || env.failure }} # Don't execute when cancelled + env: + GH_TOKEN: ${{ github.token }} + WORKFLOW_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} + run: | + curl -fLSs $(gh api https://api.github.com/repos/${{ github.repository }}/contents/scripts/assets/variants-release-mm-template.json?ref=${{ github.ref }} --jq .download_url) \ + --output message-template.json + + export MM_USER_HANDLE=$(base64 -d <<< ${{ secrets.MM_HANDLES_BASE64 }} | jq ".${{ github.actor }}" | tr -d '"') + + if [[ -z "${MM_USER_HANDLE}" ]]; then + echo "Mattermost user handle not known for ${{ github.actor }}, skipping sending message" + else + + if [[ "${{ env.success }}" == "true" ]]; then + status="success" + else + status="failure" + fi + curl -s -H 'Content-type: application/json' \ + -d "$(envsubst < message-template.json | jq ".${status}")" \ + ${{ secrets.MM_WEBHOOK_URL }} + fi