build
: Add GitHub Action config for CI/CD
#1
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: Build and Deploy to Production | |
on: | |
push: | |
branches: [master] | |
jobs: | |
deploy: | |
if: "contains(github.event.head_commit.message, 'DEPLOY')" | |
name: π Build and Deploy App | |
runs-on: ubuntu-latest | |
steps: | |
- name: π¦ Get latest code | |
uses: actions/checkout@v3 | |
- name: π Send files via SCP | |
uses: appleboy/scp-action@v0.1.4 | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
password: ${{ secrets.PASSWORD }} | |
port: ${{ secrets.PORT }} | |
source: "./*" | |
target: /root/apps/kampung_budaya_2023 | |
- name: π Rebuild docker image and rerun | |
uses: appleboy/ssh-action@v1.0.0 | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
password: ${{ secrets.PASSWORD }} | |
port: ${{ secrets.PORT }} | |
script: cd /root/apps/kampung_budaya_2023 && docker compose up -d --no-deps --build backend |