-
Notifications
You must be signed in to change notification settings - Fork 2
64 lines (60 loc) · 1.87 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
name: Deployment
on:
push:
branches:
- develop
jobs:
Deploy_API:
name: Deploy API
runs-on: ubuntu-latest
steps:
- name: Package the API codebase
uses: actions/checkout@v1
- name: Zip the whole codebase
run: |
ls -la
tar -cvf omni.tar .
- name: copy file via ssh password
uses: appleboy/scp-action@master
with:
host: "139.180.183.219"
username: root
password: ${{ secrets.SERVER_PASSWORD }}
port: 22
source: "omni.tar"
target: "/root/"
- name: Archive code deployment artifacts
uses: actions/upload-artifact@v3
with:
name: code-zip
path: omni.tar
- name: Setup AWS Credentials
uses: appleboy/ssh-action@master
with:
host: "139.180.183.219"
username: root
password: ${{ secrets.SERVER_PASSWORD }}
port: 22
script: |
cd /root
rm -rf omni
mkdir omni
tar xopf omni.tar -C omni
cd /root/omni/API
mkdir -p ./.aws
echo "[default]" > ./.aws/config
echo "region = us-west-2" >> ./.aws/config
echo "[default]" > ./.aws/credentials
echo "aws_access_key_id = ${{ secrets.AWS_ACCESS_KEY_ID }}" >> ./.aws/credentials
echo "aws_secret_access_key = ${{ secrets.AWS_SECRET_ACCESS_KEY }}" >> ./.aws/credentials
- name: Build and Restart backend
uses: appleboy/ssh-action@master
with:
host: "139.180.183.219"
username: root
password: ${{ secrets.SERVER_PASSWORD }}
port: 22
script: |
cd /root/omni/API
docker compose -f docker-compose.yml down
STORAGE_SOLUTION=api docker compose -f docker-compose.yml up --build -d