Merge pull request #91 from cabinetoffice/release/8.0 #13
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: Promote to Prod Workflow | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- '*.md' | |
env: | |
AWS_REGION: eu-west-2 | |
jobs: | |
promoteToProd: | |
environment: AWS | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- name: Setup AWS credentials | |
uses: aws-actions/configure-aws-credentials@v3 | |
with: | |
role-to-assume: ${{ secrets.AWS_ROLE_ARN }} | |
role-session-name: github-gap-find-backend | |
aws-region: ${{ env.AWS_REGION }} | |
- name: Login to AWS ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v2 | |
- name: Add prod tag to existing test image | |
# Based on steps described here - https://docs.aws.amazon.com/AmazonECR/latest/userguide/image-retag.html | |
run: | | |
MANIFEST=$(aws ecr batch-get-image --repository-name find-a-grant-api --image-ids imageTag=test --output json | jq --raw-output --join-output '.images[0].imageManifest') | |
aws ecr put-image --repository-name find-a-grant-api --image-tag prod --image-manifest "$MANIFEST" |