Skip to content

Commit

Permalink
First attempt at tag based deploy workflow.
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Peck committed Dec 17, 2023
1 parent 7eb1b0e commit c06ab6b
Showing 1 changed file with 87 additions and 0 deletions.
87 changes: 87 additions & 0 deletions .github/workflows/ci-tag-deploy.yml
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

0 comments on commit c06ab6b

Please sign in to comment.