Skip to content

Commit

Permalink
feat: standardised workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
proffapt committed Apr 20, 2024
1 parent 374866d commit 8b68c77
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Continuous Deployment for backend
name: Continuous Deployment Pipeline for backend

on:
push:
Expand All @@ -8,66 +8,66 @@ on:
- 'backend/**'

jobs:
pull:
name: Pull Stage
push:
name: Push Stage
runs-on: ubuntu-latest

steps:
- name: Sync with remote repository
- name: Sync local repo with remote repo
uses: appleboy/ssh-action@master
env:
IQPS_DIR: ${{ secrets.IQPS_DIR }}
PROJECT_DIR: ${{ secrets.PROJECT_DIR }}
with:
host: ${{ secrets.HOSTNAME }}
username: ${{ secrets.USERNAME }}
host: ${{ secrets.SSH_HOSTNAME }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
envs: IQPS_DIR
passphrase: ${{ secrets.SSH_PRIVATE_KEY_PASSPHRASE }}
envs: PROJECT_DIR
script_stop: true
script: |
cd "${IQPS_DIR}/"
cd "${PROJECT_DIR}/"
sudo git fetch origin
sudo git reset --hard origin/main
build:
name: Build Stage
needs: pull
needs: push
runs-on: ubuntu-latest

steps:
- name: Build the latest docker container
- name: Build the latest container(s)
uses: appleboy/ssh-action@master
env:
IQPS_DIR: ${{ secrets.IQPS_DIR }}
PROJECT_DIR: ${{ secrets.PROJECT_DIR }}
with:
host: ${{ secrets.HOSTNAME }}
username: ${{ secrets.USERNAME }}
host: ${{ secrets.SSH_HOSTNAME }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
envs: IQPS_DIR
passphrase: ${{ secrets.SSH_PRIVATE_KEY_PASSPHRASE }}
envs: PROJECT_DIR
script_stop: true
script: |
cd "${IQPS_DIR}/backend/"
cd "${PROJECT_DIR}/backend/"
sudo docker compose build
deploy:
name: Deploy Stage
needs: [pull, build]
needs: [push, build]
runs-on: ubuntu-latest

steps:
- name: Deploy the latest build
- name: Deploy the latest build(s)
uses: appleboy/ssh-action@master
env:
IQPS_DIR: ${{ secrets.IQPS_DIR }}
PROJECT_DIR: ${{ secrets.PROJECT_DIR }}
with:
host: ${{ secrets.HOSTNAME }}
username: ${{ secrets.USERNAME }}
host: ${{ secrets.SSH_HOSTNAME }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
envs: IQPS_DIR
passphrase: ${{ secrets.SSH_PRIVATE_KEY_PASSPHRASE }}
envs: PROJECT_DIR
script_stop: true
script: |
cd "${IQPS_DIR}/backend/"
cd "${PROJECT_DIR}/backend/"
sudo docker compose down
sudo docker compose up -d

0 comments on commit 8b68c77

Please sign in to comment.