-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (48 loc) · 1.74 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
56
57
58
59
name: Deploy
run-name: ${{ github.event_name == 'workflow_dispatch' && format('Deploy to {0}', inputs.environment) || null }}
on:
push:
branches: [main]
workflow_dispatch:
inputs:
environment:
description: "Deployment environment"
required: true
type: choice
options:
- test
- training
jobs:
copilot:
name: AWS Copilot deploy
permissions:
id-token: write
contents: read
environment:
name: ${{ github.event.inputs.environment || 'test' }}
url: https://${{ steps.host-name.outputs.value }}
concurrency:
group: ${{ github.ref }}-${{ github.event.inputs.environment || 'test' }}
cancel-in-progress: true
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::393416225559:role/GitHubActionsRole
aws-region: eu-west-2
- name: Install and Verify AWS Copilot
run: |
curl -Lo /tmp/copilot https://github.com/aws/copilot-cli/releases/latest/download/copilot-linux
chmod +x /tmp/copilot
mv /tmp/copilot /usr/local/bin/copilot
copilot --version
- name: Deploy the application using AWS Copilot
run: |
copilot svc deploy --name webapp --env ${{ github.event.inputs.environment || 'test' }}
- name: Get host name
id: host-name
run: |
echo "value=$(copilot svc show --name webapp --json | jq -r '.variables[] | select(.name == "MAVIS__HOST") | select(.environment == "${{ github.event.inputs.environment || 'test' }}") | .value')" >> $GITHUB_OUTPUT