Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First attempt at tag based deploy workflow. #50

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this trigger script to look at the tagged repository and redeploy all of the associated services? Are we assuming that the workflow is "merge to main, run in QA for a while, then tag to trigger live release?" i.e. the images to be deployed are already build and pushed to ECR?

-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

Loading