-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First attempt at tag based deploy workflow.
- Loading branch information
Martin Peck
committed
Dec 17, 2023
1 parent
7eb1b0e
commit c06ab6b
Showing
1 changed file
with
87 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
name: Live Deploy | ||
|
||
on: | ||
push: | ||
# Pattern matched against refs/tags | ||
tags: | ||
- '*' | ||
|
||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
jobs: | ||
live-deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Kick off Terraform deploy in sysops/ | ||
id: sysops-deploy | ||
run: | | ||
curl \ | ||
-X POST \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "Authorization: Bearer ${{ secrets.SYSOPS_RW_GITHUB_TOKEN }}" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
https://api.github.com/repos/meedan/sysops/actions/workflows/deploy_${{ github.event.repository.name }}.yml/dispatches \ | ||
-d '{"ref": "master", "inputs": {"git_tag": "${{ github.ref_name }}"}}' | ||
- name: Send GitHub Action trigger data to Slack workflow on success | ||
id: slack-api-notify-success | ||
if: ${{ success() }} | ||
uses: slackapi/[email protected] | ||
with: | ||
payload: | | ||
{ | ||
"attachments": [ | ||
{ | ||
"color": "#00FF00", | ||
"blocks": [ | ||
{ | ||
"type": "section", | ||
"text": { | ||
"type": "mrkdwn", | ||
"text": "Kicked off by: ${{ github.triggering_actor }}\nWorkflow: https://github.com/meedan/presto/actions/runs/${{ github.run_id }}" | ||
} | ||
}, | ||
{ | ||
"type": "section", | ||
"text": { | ||
"type": "mrkdwn", | ||
"text": "Presto Live Deploy:\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}" | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.CHECK_DEV_BOTS_SLACK_WEBHOOK_URL }} | ||
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK | ||
|
||
- name: Send GitHub Action trigger data to Slack workflow on failure | ||
id: slack-api-notify-failure | ||
if: ${{ failure() }} | ||
uses: slackapi/[email protected] | ||
with: | ||
payload: | | ||
{ | ||
"attachments": [ | ||
{ | ||
"color": "#FF0000", | ||
"blocks": [ | ||
{ | ||
"type": "section", | ||
"text": { | ||
"type": "mrkdwn", | ||
"text": "Presto Live Deploy failed\nWorkflow: https://github.com/meedan/presto/actions/runs/${{ github.run_id }}" | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.ITS_BOTS_SLACK_WEBHOOK_URL }} | ||
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK | ||
|