Deploying Consignment Export 0.0.455 to staging #589
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 Consignment Export | |
permissions: | |
id-token: write | |
on: | |
workflow_dispatch: | |
inputs: | |
environment: | |
type: choice | |
description: 'Environment' | |
required: true | |
options: | |
- intg | |
- staging | |
- prod | |
default: 'intg' | |
to-deploy: | |
description: 'Version to deploy' | |
required: true | |
run-name: Deploying Consignment Export ${{inputs.to-deploy}} to ${{inputs.environment}} | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
environment: ${{ github.event.inputs.environment }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Configure AWS credentials for ECR | |
uses: aws-actions/configure-aws-credentials@v1-node16 | |
with: | |
role-to-assume: arn:aws:iam::${{ secrets.MANAGEMENT_ACCOUNT }}:role/TDRGithubActionsRoleMgmt | |
aws-region: eu-west-2 | |
role-session-name: ECRLogin | |
- name: Login to ECR | |
uses: docker/login-action@v1 | |
with: | |
registry: ${{ secrets.MANAGEMENT_ACCOUNT }}.dkr.ecr.eu-west-2.amazonaws.com | |
- name: Tag image | |
run: | | |
docker pull ${{ secrets.MANAGEMENT_ACCOUNT }}.dkr.ecr.eu-west-2.amazonaws.com/consignment-export:${{ github.event.inputs.to-deploy }} | |
docker tag ${{ secrets.MANAGEMENT_ACCOUNT }}.dkr.ecr.eu-west-2.amazonaws.com/consignment-export:${{ github.event.inputs.to-deploy }} ${{ secrets.MANAGEMENT_ACCOUNT }}.dkr.ecr.eu-west-2.amazonaws.com/consignment-export:${{ github.event.inputs.environment }} | |
docker push ${{ secrets.MANAGEMENT_ACCOUNT }}.dkr.ecr.eu-west-2.amazonaws.com/consignment-export:${{ github.event.inputs.environment }} | |
- name: Send success message | |
uses: nationalarchives/tdr-github-actions/.github/actions/slack-send@main | |
with: | |
message: "*consignment-export* :whale: The '${{ github.event.inputs.to-deploy }}' image has been tagged with '${{ github.event.inputs.environment }}' in ECR" | |
slack-url: ${{ secrets.SLACK_WEBHOOK }} | |
- name: Run E2E tests | |
if: inputs.environment != 'prod' | |
uses: octokit/[email protected] | |
with: | |
route: POST /repos/nationalarchives/tdr-e2e-tests/actions/workflows/ci.yml/dispatches | |
ref: master | |
inputs: "{\"environment\": \"${{ inputs.environment }}\", \"wait\": \"0\", \"repo-details\": \"tdr-consignment-export@${{ inputs.to-deploy }}\"}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.WORKFLOW_PAT }} |