-
Notifications
You must be signed in to change notification settings - Fork 6
39 lines (37 loc) · 1.17 KB
/
cd.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
name: Deploy
on:
push:
branches:
- main
jobs:
deploy:
name: Deploy to ECS
runs-on: ubuntu-latest
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set branch name
id: vars
run: echo ::set-output name=stage::${GITHUB_REF#refs/*/}
- name: Set env.ENVIRONMENT_NAME
run: |
if [[ ${{ steps.vars.outputs.stage }} == 'main' ]]; then
echo "ENVIRONMENT_NAME=dev" >> "$GITHUB_ENV"
else
echo "ENVIRONMENT_NAME=${{ steps.vars.outputs.stage }}" >> "$GITHUB_ENV"
fi
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Setup AWS Copilot
uses: softprops/setup-aws-copilot@v1
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
- name: Deploy ECS
run: |
./scripts/update-ecs.sh gotemplatemysql ${{ env.ENVIRONMENT_NAME }}