From 5bc1afe5b322b6b5dc20c63bd2845aaa77a7f742 Mon Sep 17 00:00:00 2001 From: Lam Nguyen Date: Tue, 20 May 2025 11:42:49 -0700 Subject: [PATCH 1/4] Workflow: Add slack notification upon release published --- .github/workflows/build-push.yml | 3 -- .github/workflows/release-build.yml | 24 ++++++++++++ .github/workflows/slack-notification.yml | 49 ++++++++++++++++++++++++ 3 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/release-build.yml create mode 100644 .github/workflows/slack-notification.yml diff --git a/.github/workflows/build-push.yml b/.github/workflows/build-push.yml index c7fa281..ecacdc7 100644 --- a/.github/workflows/build-push.yml +++ b/.github/workflows/build-push.yml @@ -1,9 +1,6 @@ name: build preview on: - release: - types: - - published pull_request: branches: - "*" diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml new file mode 100644 index 0000000..01fa09d --- /dev/null +++ b/.github/workflows/release-build.yml @@ -0,0 +1,24 @@ +name: Build preview on documentation repo upon release publish + +on: + release: + types: + - published + +env: + OWNER: nginx + REPO: nginx-hugo-theme + +jobs: + trigger-documentation-build: + runs-on: ubuntu-latest + steps: + - name: Trigger 'Build and deploy' workflow in 'documentation' repo + run: | + curl -L \ + -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ secrets.F5_CLA_TOKEN }}" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + "https://api.github.com/repos/${{ env.OWNER }}/${{ env.REPO }}/dispatches" \ + -d "{"event_type": "trigger-preview-build", "client_payload": {"environment": "preview", "hugo_theme_override": "", "author": "${{ github.event.release.author }}", "tag_name": "${{ github.event.release.tag_name }}", "release_name": "${{ github.event.release.name }}"}}" \ No newline at end of file diff --git a/.github/workflows/slack-notification.yml b/.github/workflows/slack-notification.yml new file mode 100644 index 0000000..8eacab0 --- /dev/null +++ b/.github/workflows/slack-notification.yml @@ -0,0 +1,49 @@ +name: Slack notification for new theme release + +on: + repository_dispatch: + types: [trigger-slack-notification] + +permissions: + contents: read + +jobs: + release-notification: + runs-on: ubuntu-latest + permissions: + contents: read + actions: read # for 8398a7/action-slack + checks: read + steps: + - name: Send notification + uses: 8398a7/action-slack@1750b5085f3ec60384090fb7c52965ef822e869e # v3.18.0 + with: + status: custom + custom_payload: | + { + username: 'Github', + mention: 'channel', + attachments: [{ + title: `New theme release - ${{ github.event.client_payload.release_name }}`, + color: '#009223', + fields: [ + { + title: 'Tag', + value: ${{ github.event.client_payload.tag_name }}, + short: true + }, + { + title: 'Author', + value: ${{ github.event.client_payload.author }}, + short: true + }, + { + title: 'Preview URL', + value: ${{ github.event.client_payload.previewURL }}, + short: true + }] + }] + } + env: + SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} From c5061e25c0582b7deeb24680c01aca5aa527b1d1 Mon Sep 17 00:00:00 2001 From: Lam Nguyen Date: Thu, 22 May 2025 10:52:14 -0700 Subject: [PATCH 2/4] Workflow: Corrected owner env --- .github/workflows/release-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml index 01fa09d..74e2477 100644 --- a/.github/workflows/release-build.yml +++ b/.github/workflows/release-build.yml @@ -6,7 +6,7 @@ on: - published env: - OWNER: nginx + OWNER: nginxinc REPO: nginx-hugo-theme jobs: From abab11a362b9377d3ac3ea5d0e8a654dbaff7a8f Mon Sep 17 00:00:00 2001 From: Lam Nguyen Date: Thu, 22 May 2025 12:38:03 -0700 Subject: [PATCH 3/4] Workflow: Updated PAT name --- .github/workflows/release-build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml index 74e2477..92068eb 100644 --- a/.github/workflows/release-build.yml +++ b/.github/workflows/release-build.yml @@ -6,8 +6,8 @@ on: - published env: - OWNER: nginxinc - REPO: nginx-hugo-theme + OWNER: nginx + REPO: documentation jobs: trigger-documentation-build: @@ -18,7 +18,7 @@ jobs: curl -L \ -X POST \ -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer ${{ secrets.F5_CLA_TOKEN }}" \ + -H "Authorization: Bearer ${{ secrets.DOCUMENTATION_SLACK_FLOW_PAT }}" \ -H "X-GitHub-Api-Version: 2022-11-28" \ "https://api.github.com/repos/${{ env.OWNER }}/${{ env.REPO }}/dispatches" \ - -d "{"event_type": "trigger-preview-build", "client_payload": {"environment": "preview", "hugo_theme_override": "", "author": "${{ github.event.release.author }}", "tag_name": "${{ github.event.release.tag_name }}", "release_name": "${{ github.event.release.name }}"}}" \ No newline at end of file + -d "{\"event_type\": \"trigger-preview-build\", \"client_payload\": {\"environment\": \"preview\", \"hugo_theme_override\": \"\", \"author\": \"${{ github.event.release.author.login }}\", \"tag_name\": \"${{ github.event.release.tag_name }}\", \"release_name\": \"${{ github.event.release.name }}\"}}" \ No newline at end of file From 8bb5c419d8005138f03b65164950f83cd7cd3581 Mon Sep 17 00:00:00 2001 From: Lam Nguyen Date: Tue, 17 Jun 2025 06:43:57 -0700 Subject: [PATCH 4/4] Workflow: Removed slack notification and moved to documentation repo --- .github/workflows/slack-notification.yml | 49 ------------------------ 1 file changed, 49 deletions(-) delete mode 100644 .github/workflows/slack-notification.yml diff --git a/.github/workflows/slack-notification.yml b/.github/workflows/slack-notification.yml deleted file mode 100644 index 8eacab0..0000000 --- a/.github/workflows/slack-notification.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: Slack notification for new theme release - -on: - repository_dispatch: - types: [trigger-slack-notification] - -permissions: - contents: read - -jobs: - release-notification: - runs-on: ubuntu-latest - permissions: - contents: read - actions: read # for 8398a7/action-slack - checks: read - steps: - - name: Send notification - uses: 8398a7/action-slack@1750b5085f3ec60384090fb7c52965ef822e869e # v3.18.0 - with: - status: custom - custom_payload: | - { - username: 'Github', - mention: 'channel', - attachments: [{ - title: `New theme release - ${{ github.event.client_payload.release_name }}`, - color: '#009223', - fields: [ - { - title: 'Tag', - value: ${{ github.event.client_payload.tag_name }}, - short: true - }, - { - title: 'Author', - value: ${{ github.event.client_payload.author }}, - short: true - }, - { - title: 'Preview URL', - value: ${{ github.event.client_payload.previewURL }}, - short: true - }] - }] - } - env: - SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}