Merge pull request #1194 from govuk-one-login/origin/AUT-1356/adding-… #231
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |