-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (73 loc) · 2.3 KB
/
build.aws.staging.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
name: Build & Deploy AWS Staging CI
on:
push:
branches: [staging]
jobs:
build_bp_gallery:
name: Build & Deploy bp-gallery
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./projects/bp-gallery
strategy:
matrix:
node-version: [18.x]
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Install bp-gallery dependencies
run: yarn install --frozen-lockfile
- name: Install bp-graphql dependencies
working-directory: ./projects/bp-graphql
run: yarn install --frozen-lockfile && tsc
- name: Generate APIConnector
run: yarn generate-api
- name: Build bp-gallery
run: yarn build:dev
- name: Deploy build files on the server
uses: appleboy/scp-action@master
with:
host: ${{ secrets.AWS_REMOTE_HOST }}
username: ${{ secrets.REMOTE_USER }}
key: ${{ secrets.AWS_SSH_KEY }}
source: "projects/bp-gallery/build/"
strip_components: 3
target: ${{ secrets.AWS_REMOTE_STAGING_TARGET }}
rm: true
build_bp_strapi:
name: Build & Deploy bp-strapi
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./projects/bp-strapi
strategy:
matrix:
node-version: [18.x]
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Set up SSH
run: |
mkdir -p ~/.ssh/
echo "$SSH_KEY" > ./deploy_key
sudo chmod 600 ./deploy_key
echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
shell: bash
env:
SSH_KEY: ${{secrets.AWS_SSH_KEY}}
SSH_KNOWN_HOSTS: ${{secrets.AWS_SSH_KNOWN_HOSTS}}
- name: Install PM2 for deployment
run: yarn global add pm2
- name: Deploy strapi on the server
run: pm2 deploy ecosystem.aws.config.js staging
env:
REMOTE_HOST: ${{secrets.AWS_REMOTE_HOST}}
REMOTE_USER: ${{secrets.REMOTE_USER}}