-
Notifications
You must be signed in to change notification settings - Fork 1
75 lines (68 loc) · 2.29 KB
/
deployment-aws.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
name: Deploy to AWS
on:
push:
branches: [ deployment-aws-production, deployment-aws-staging ]
workflow_dispatch:
inputs:
target:
description: 'Target'
required: true
default: 'production'
type: choice
options:
- 'staging'
- 'production'
jobs:
deploy:
name: Deploy to AWS
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Setup Dart SDK
uses: dart-lang/[email protected]
with:
sdk: 2.18.1
- 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: us-west-2
- name: Create passwords file
working-directory: bacterialboom_server
shell: bash
env:
SERVERPOD_PASSWORDS: ${{ secrets.SERVERPOD_PASSWORDS }}
run: |
pwd
echo "$SERVERPOD_PASSWORDS" > config/passwords.yaml
ls config/
- name: Get Dart packages
working-directory: bacterialboom_server
run: dart pub get
- name: Compile server
working-directory: bacterialboom_server
run: dart compile kernel bin/main.dart
- name: Create CodeDeploy Deployment
id: deploy
env:
PROJECT_NAME: bacterialboom
AWS_NAME: bacterialboom
DEPLOYMENT_BUCKET: bacterialboom-deployment-3819825
TARGET: ${{ github.event.inputs.target }}
run: |
# Deploy server to AWS
TARGET="${TARGET:=${GITHUB_REF##*-}}"
echo "Deploying to target: $TARGET"
mkdir -p vendor
cp "${PROJECT_NAME}_server/deploy/aws/scripts/appspec.yml" appspec.yml
zip -r deployment.zip .
aws s3 cp deployment.zip "s3://${DEPLOYMENT_BUCKET}/deployment.zip"
aws deploy create-deployment \
--application-name "${AWS_NAME}-app" \
--deployment-group-name "${AWS_NAME}-${TARGET}-group" \
--deployment-config-name CodeDeployDefault.OneAtATime \
--s3-location "bucket=${DEPLOYMENT_BUCKET},key=deployment.zip,bundleType=zip"