-
Notifications
You must be signed in to change notification settings - Fork 1
55 lines (55 loc) · 2.45 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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 }}