-
Notifications
You must be signed in to change notification settings - Fork 2
69 lines (59 loc) · 2.22 KB
/
deploy.yaml
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
60
61
62
63
64
65
66
67
68
69
name: Deploy
on:
workflow_dispatch:
push:
branches: [main, cicd]
jobs:
deploy:
runs-on: ubuntu-18.04
steps:
- name: checkout
uses: actions/checkout@v2
- name: install Go
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: Get current time
uses: 1466587594/get-current-time@v2
id: current-time
with:
format: YYYYMMDD-HH-mm-ss
- name: Create directories
run: |
mkdir -p rest-api/deploy
mkdir -p api-gateway/deploy
- name: Configure AWS credentials from Test account
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: ap-northeast-2
- name: Copy config file
run: |
aws ssm get-parameter --name ${{ secrets.REST_PARAMETER_NAME_DEV }} --query "Parameter.Value" --output text > rest-api/config/dev.yml
aws ssm get-parameter --name ${{ secrets.SERVICE_ACCOUNT_PARAMETER_NAME_DEV }} --query "Parameter.Value" --output text > rest-api/config/service-account-dev.json
aws ssm get-parameter --name ${{ secrets.GATEWAY_PARAMETER_NAME_DEV }} --query "Parameter.Value" --output text > api-gateway/config/dev.yml
- name: Build rest-api
working-directory: rest-api
run: |
GOOS=linux GOARCH=amd64 go build -o rest .
- name: Build api-gateway
working-directory: api-gateway
run: |
GOOS=linux GOARCH=amd64 go build -o gw .
- name: prepare to deploy
run: |
zip -r deploy.zip .
# ref) https://github.com/marketplace/actions/beanstalk-deploy
- name: deploy to eb
uses: einaregilsson/beanstalk-deploy@v18
with:
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# secrets.APPLICATION_NAME,ENVIRONMENT_NAME 이렇게 하자...
application_name: everybody
environment_name: Everybody-dev
version_label: ${{ steps.current-time.outputs.formattedTime }}-${{ github.run_id }}
region: ap-northeast-2
deployment_package: deploy.zip
# wait_for_environment_recovery: 200