[major] deleted dir backend + frontend, #33
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: CI/CD Pipeline | |
on: | |
push: | |
branches: | |
- main # Trigger the workflow when pushing to the main branch | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up SSH | |
run: | | |
mkdir -p ~/.ssh | |
echo "${{ secrets.SSH_KEY }}" > ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
- name: Deploy using SSH | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
key: ${{ secrets.SSH_KEY }} | |
script: | | |
if [ -d "ornatewall-server-app" ]; then | |
echo "Repository exists. Pulling latest changes..." | |
cd ornatewall-server-app | |
git reset --hard | |
git pull origin main | |
else | |
echo "Cloning repository..." | |
git clone https://github.com/akhilsharmaa/ornatewall-server-app.git | |
cd ornatewall-server-app | |
fi | |
sudo docker-compose down || true | |
sudo docker-compose pull | |
sudo docker-compose up --build -d |