-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (65 loc) · 2.44 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: Deploy
on:
push:
branches:
- base
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: ${{ github.ref_name }}
env:
APPLICATION_NAME: cartographer_frontend
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/[email protected]
with:
node-version: 'lts/*'
cache: 'yarn'
- name: Install dependencies
run: yarn install
- name: Build project
run: CI=false yarn build
- name: Export secrets to environment variables
uses: oNaiPs/[email protected]
with:
secrets: ${{ toJSON(secrets) }}
- name: Clone deploy scripts if not present
run: git clone https://github.com/RockefellerArchiveCenter/deploy_scripts.git;
- name: Substitute environment variables
uses: tvarohohlavy/[email protected]
with:
files: |
appspec.yml.deploy
deploy_scripts/curl_index.sh.deploy
deploy_scripts/set_permissions.sh.deploy
- name: Rename deploy files
run: |
mv appspec.yml.deploy appspec.yml
mv deploy_scripts/curl_index.sh.deploy deploy_scripts/curl_index.sh
mv deploy_scripts/set_permissions.sh.deploy deploy_scripts/set_permissions.sh
- name: Make deploy scripts executable
run: chmod +x deploy_scripts/*.sh
- name: Create deployable zip
run: sudo deploy_scripts/make_zip_react.sh $DEPLOY_ZIP_DIR $DEPLOY_ZIP_NAME
- name: Configure AWS Credentials
uses: aws-actions/[email protected]
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }}
role-to-assume: ${{ secrets.AWS_DEPLOY_ROLE }}
role-skip-session-tagging: true
role-duration-seconds: 900
aws-region: ${{ secrets.AWS_REGION }}
- name: Deploy to S3
run: aws s3 cp $DEPLOY_ZIP_DIR s3://$AWS_BUCKET_NAME --recursive
- name: Deploy to AWS CodeDeploy
run: aws deploy create-deployment
--region ${{ secrets.AWS_REGION }}
--application-name $APPLICATION_NAME
--deployment-config-name CodeDeployDefault.OneAtATime
--deployment-group-name $DEPLOYMENT_GROUP
--s3-location bucket=$AWS_BUCKET_NAME,bundleType=zip,key=$DEPLOY_ZIP_NAME