Skip to content

Deploy to Production #21

Deploy to Production

Deploy to Production #21

name: Deploy to Production
on:
workflow_dispatch:
inputs:
version:
description: Version to deploy
required: true
jobs:
deploy-to-production:
runs-on: ubuntu-20.04
env:
DOCKER_IMAGE: ghcr.io/dfe-digital/help-for-early-years-providers-prod
steps:
- name: Check workflow concurrency
uses: softprops/turnstyle@v1
with:
poll-interval-seconds: 20
same-branch-only: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.version }}
- name: Pin Terraform version
uses: hashicorp/[email protected]
with:
terraform_version: 0.14.0
- name: Deploy to production
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_PROD }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_PROD }}
TF_VAR_paas_user: ${{ secrets.GOVPAAS_USERNAME_PROD }}
TF_VAR_paas_password: ${{ secrets.GOVPAAS_PASSWORD_PROD }}
TF_VAR_statuscake_username: ${{ secrets.STATUSCAKE_USERNAME }}
TF_VAR_statuscake_apikey: ${{ secrets.STATUSCAKE_APIKEY }}
run: |
export TF_VAR_paas_app_docker_image=${{ env.DOCKER_IMAGE }}:${{ github.event.inputs.version }}
cd terraform/app
terraform init -reconfigure -input=false -backend-config="bucket=${{secrets.AWS_BUCKET_PROD}}"
terraform apply -input=false -auto-approve -var-file ../workspace-variables/prod.tfvars -var='secret_paas_app_env_values={"RAILS_MASTER_KEY":"${{secrets.RAILS_MASTER_KEY_PROD}}", "RELEASE_VERSION":"${{github.event.inputs.version}}", "AWS_ACCESS_KEY_ID": "${{secrets.AWS_ACCESS_KEY_ID_PROD}}", "AWS_SECRET_ACCESS_KEY": "${{secrets.AWS_SECRET_ACCESS_KEY_PROD}}", "AWS_REGION": "${{secrets.AWS_REGION}}", "AWS_BUCKET": "${{secrets.AWS_BUCKET_PROD}}", "BASIC_AUTH_USER": "${{secrets.BASIC_AUTH_USER}}", "BASIC_AUTH_PASSWORD": "${{secrets.BASIC_AUTH_PASSWORD}}"}'
- name: Install CF CLI on Prod
uses: DFE-Digital/github-actions/setup-cf-cli@master
with:
CF_USERNAME: ${{ secrets.GOVPAAS_USERNAME_PROD }}
CF_PASSWORD: ${{ secrets.GOVPAAS_PASSWORD_PROD }}
CF_SPACE_NAME: eyfs-prod
# Optional inputs
CF_CLI_VERSION: v7 # default v7, allowed values: v6 or v7
CF_ORG_NAME: dfe # default
CF_API_URL: https://api.london.cloud.service.gov.uk # default
INSTALL_CONDUIT: false # default: false
- name: Remap DNS route on Prod
run: |
cf map-route eyfs-prod education.gov.uk --hostname help-for-early-years-providers