Skip to content

Deploy release to prod #12

Deploy release to prod

Deploy release to prod #12

Workflow file for this run

on:
workflow_dispatch:
inputs:
release_tag:
description: 'Release tag version to deploy to production'
required: false
type: string
name: Deploy release to prod
jobs:
deploy-to-prod-env:
runs-on: [ARM64, self-hosted, Linux]
environment: production
permissions:
id-token: write
contents: read
steps:
- name: Get latest or specified release
uses: actions/github-script@v7
id: get-release
with:
retries: 3
result-encoding: string
script: |
let releaseObj;
if (${{ github.event.inputs.release_tag != '' }}) {
releaseObj = github.rest.repos.getReleaseByTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag: "${{ github.event.inputs.release_tag }}"
})
} else {
releaseObj = github.rest.repos.getLatestRelease({
owner: context.repo.owner,
repo: context.repo.repo
})
}
return releaseObj.tag_name
- name: Output Github Release
if: steps.get-release.outputs.result != ''
id: set-release-tag
run: |
parsed_tag_name=${{ steps.get-release.outputs.result }}
echo "Tag name is: $parsed_tag_name"
echo "release_tag=$parsed_tag_name\n" >> $GITHUB_OUTPUT
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ steps.set-release-tag.outputs.release_tag }}
# - name: Assume happy-api deployment role
# uses: aws-actions/configure-aws-credentials@v2
# with:
# aws-region: us-west-2
# role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
# role-duration-seconds: 1200
# role-session-name: CzidGraphQLFederationUpdateProd
# - name: Install happy
# uses: chanzuckerberg/github-actions/.github/actions/install-happy@main
# - name: Set git SHA
# uses: chanzuckerberg/czid-graphql-federation-server/.github/actions/happy-config-set@main
# with:
# app_config_name: CZID_GQL_FED_GIT_SHA
# app_config_value: ${{ github.sha }}
# happy_env: prod
# - name: Set release version
# uses: chanzuckerberg/czid-graphql-federation-server/.github/actions/happy-config-set@main
# with:
# app_config_name: CZID_GQL_FED_GIT_VERSION
# app_config_value: ${{ github.event.release.tag_name || }}
# happy_env: prod
# - name: Set CZ ID Rails API URL
# uses: chanzuckerberg/czid-graphql-federation-server/.github/actions/happy-config-set@main
# with:
# app_config_name: API_URL
# app_config_value: ${{ vars.API_URL}}
# happy_env: prod
# - name: Set allowed CORS origins
# uses: chanzuckerberg/czid-graphql-federation-server/.github/actions/happy-config-set@main
# with:
# app_config_name: ALLOWED_CORS_ORIGINS
# app_config_value: ${{ vars.ALLOWED_CORS_ORIGINS}}
# happy_env: prod
# - name: Deploy to production env
# uses: chanzuckerberg/github-actions/.github/actions/[email protected]
# with:
# tfe-token: ${{ secrets.TFE_TOKEN }}
# env: ${{ vars.HAPPY_ENV }}
# image-source-env: ${{ vars.IMAGE_SOURCE_ENV }}
# image-source-stack: ${{ secrets.IMAGE_SOURCE_STACK }}
# image-source-role-arn: ${{ secrets.IMAGE_SOURCE_ROLE_ARN }}
# stack-name: ${{ secrets.HAPPY_STACK_NAME }}
# version-lock-file: .happy/version.lock