Skip to content

Merge pull request #1694 from govuk-one-login/AUT-1466/re-implement-w… #932

Merge pull request #1694 from govuk-one-login/AUT-1466/re-implement-w…

Merge pull request #1694 from govuk-one-login/AUT-1466/re-implement-w… #932

name: Deploy frontend
env:
AWS_REGION: eu-west-2
# Deploy role & Artificate buckets are Logical id GitHubActionsRole & GitHubArtifactSourceBucket Value from Build Pipeline
on:
push:
branches:
- main
workflow_run:
workflows: ["Build frontend"]
types:
- completed
jobs:
deploy:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.DEPLOY_ROLE }}
aws-region: ${{ env.AWS_REGION }}
- name: Upload frontend Terraform files
working-directory: ci/terraform
run: |
zip -r frontend.zip .
S3_RESPONSE=`aws s3api put-object \
--bucket ${{ secrets.ARTIFACT_BUCKET }} \
--key frontend.zip \
--body frontend.zip \
--metadata "repository=$GITHUB_REPOSITORY,commitsha=$GITHUB_SHA,committag=$GIT_TAG,commitmessage=$COMMIT_MSG"`
VERSION=`echo $S3_RESPONSE | jq .VersionId -r`
echo "VERSION=$VERSION" >> $GITHUB_ENV