diff --git a/.github/workflows/pipeline-develop.yml b/.github/workflows/pipeline-develop.yml index 0c20062..c56d2b7 100644 --- a/.github/workflows/pipeline-develop.yml +++ b/.github/workflows/pipeline-develop.yml @@ -5,11 +5,11 @@ on: - develop jobs: - build: - name: Build + deploy: + name: Deploy runs-on: ubuntu-latest steps: - - name: Production Auto-Deploy + - name: Staging Auto-Deploy uses: appleboy/ssh-action@v1.0.3 with: host: ${{ secrets.STAGING_HOST }} diff --git a/.github/workflows/pipeline-main.yml b/.github/workflows/pipeline-main.yml new file mode 100644 index 0000000..8b7cf8a --- /dev/null +++ b/.github/workflows/pipeline-main.yml @@ -0,0 +1,25 @@ +name: auto-deploy-main +on: + push: + branches: + - main +jobs: + + deploy: + name: Deploy + runs-on: ubuntu-latest + steps: + - name: Production Auto-Deploy + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ secrets.PROD_HOST }} + username: ${{ secrets.PROD_USERNAME }} + key: ${{ secrets.PROD_PRIVATE_KEY }} + port: 22 + script: | + cd $HOME/DeVouch-BE + git checkout main + git checkout -- . + git pull + docker compose stop devouch squid-db + docker compose up -d --build \ No newline at end of file diff --git a/.github/workflows/start-devouch.yml b/.github/workflows/start-devouch-develop.yml similarity index 93% rename from .github/workflows/start-devouch.yml rename to .github/workflows/start-devouch-develop.yml index 762a6fa..ee1d60f 100644 --- a/.github/workflows/start-devouch.yml +++ b/.github/workflows/start-devouch-develop.yml @@ -1,4 +1,4 @@ -name: start-devouch +name: start-devouch-develop on: workflow_dispatch: diff --git a/.github/workflows/start-devouch-main.yml b/.github/workflows/start-devouch-main.yml new file mode 100644 index 0000000..431b73f --- /dev/null +++ b/.github/workflows/start-devouch-main.yml @@ -0,0 +1,21 @@ +name: start-devouch-main + +on: + workflow_dispatch: + +jobs: + + start: + name: Start Devouch + runs-on: ubuntu-latest + steps: + - name: Start Devouch + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ secrets.PROD_HOST }} + username: ${{ secrets.PROD_USERNAME }} + key: ${{ secrets.PROD_PRIVATE_KEY }} + port: 22 + script: | + cd $HOME/DeVouch-BE + docker compose up -d --build \ No newline at end of file diff --git a/.github/workflows/stop-devouch.yml b/.github/workflows/stop-devouch-develop.yml similarity index 95% rename from .github/workflows/stop-devouch.yml rename to .github/workflows/stop-devouch-develop.yml index bd89580..258bbd1 100644 --- a/.github/workflows/stop-devouch.yml +++ b/.github/workflows/stop-devouch-develop.yml @@ -1,4 +1,4 @@ -name: stop-devouch +name: stop-devouch-develop on: workflow_dispatch: diff --git a/.github/workflows/stop-devouch-main.yml b/.github/workflows/stop-devouch-main.yml new file mode 100644 index 0000000..7885c6e --- /dev/null +++ b/.github/workflows/stop-devouch-main.yml @@ -0,0 +1,24 @@ +name: stop-devouch-main + +on: + workflow_dispatch: + +jobs: + + stop: + name: Stop Devouch + runs-on: ubuntu-latest + steps: + - name: Stop Devouch + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ secrets.PROD_HOST }} + username: ${{ secrets.PROD_USERNAME }} + key: ${{ secrets.PROD_PRIVATE_KEY }} + port: 22 + script: | + cd $HOME/DeVouch-BE + docker compose stop devouch squid-db + docker compose rm -f -v devouch squid-db + docker rmi -f $(docker images | grep 'devouch' | awk '{print $3}') + docker volume rm $(docker volume ls | grep 'db-data' | awk '{print $2}')