Merge pull request #83 from AI4WA/doc #31
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |