Skip to content

Scheduled Deploy

Scheduled Deploy #269

name: Scheduled Deploy
on:
# Vince, Mar 31 2023: Since updates are less frequent at the moment, turning
# off scheduled deploys for now in favor of manual Prod pushes only.
# schedule:
# # Weekly Tuesday & Thursdays @ 16:00 UTC (8am PST [winter] / 9am PDT [summer])
# - cron: '0 16 * * 2,4'
workflow_dispatch:
inputs:
image_tag:
description: 'Docker image tag to use for a deploy (defaults to latest successful staging deploy)'
required: false
default: ''
environment:
description: 'deploy to staging or prod'
required: false
default: 'prod'
# https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services
permissions:
id-token: write
contents: read
env:
DOCKER_BUILDKIT: 1
COMPOSE_DOCKER_CLI_BUILD: 1
DOCKER_REPO: ${{ secrets.ECR_REPO }}/
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
upgrade:
runs-on: ubuntu-20.04
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-session-name: ScheduledProdDeploy
aws-region: us-west-2
role-to-assume: ${{ secrets.AWS_PROD_ROLE_TO_ASSUME }}
role-duration-seconds: 900
- uses: actions/checkout@v2
- name: Determine the tag
uses: chanzuckerberg/github-actions/.github/actions/[email protected]
with:
environment: staging
owner: chanzuckerberg
repo: czgenepi
happy_version: "0.41.3"
- name: Generate payload
run: |
if [ -n "${{ github.event.inputs.image_tag }}" ]; then
echo "Using workflow dispatch to deploy tag ${{ github.event.inputs.image_tag }}"
echo "payload={\"tag\":\"${{ github.event.inputs.image_tag }}\"}" >> $GITHUB_ENV
else
echo "payload={\"tag\":\"sha-${DEPLOY_SHA:0:8}\"}" >> $GITHUB_ENV
fi
- uses: avakar/[email protected]
with:
auto_merge: false
environment: ${{ github.event.inputs.environment || 'prod' }}
payload: ${{ env.payload }}
required_contexts: ""
env:
GITHUB_TOKEN: ${{ secrets.CZIBUILDBOT_GITHUB_TOKEN }}