-
Notifications
You must be signed in to change notification settings - Fork 2
46 lines (38 loc) · 1.82 KB
/
codedeploy-staging-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
40
41
42
43
44
45
46
name: AWS Codedeploy CD
# Controls when the action will run.
on:
push:
branches: [staging-sandbox]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Build & Generate backend deployment package
run: cd server && yarn && yarn build && cd ..
- name: Build & Generate frontend deployment package
run: echo $REACT_APP_API_BASE_URL && cd frontend && yarn && yarn build && cd ..
env:
REACT_APP_API_BASE_URL: https://api.staging.roadmapper.vincit.fi/
CI: false
- 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: 'eu-central-1'
- name: Sync frontend files to s3 static hosting bucket
run:
# Assuming the Frontend hosting bucket is already setup
# CDK deployment script outputs the bucket name
aws s3 sync ./frontend/build/ s3://staging.roadmapper.vincit.fi/ --delete
- name: Execute CodeDeploy backend deployment
run:
# Assuming the Deployment Group is already setup
# CDK deployment script outputs the application and deployment group names
aws deploy create-deployment --application-name StagingBackendCodeDeploy --deployment-group-name StagingBackendDeploymentGroup --github-location repository=${{ github.repository }},commitId=${{ github.sha }}