k #40
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: Deploy | |
on: | |
push: | |
branches: [ node ] | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Access to Server, Remove Docker Containers, Build Docker Image, Run Docker Container | |
run: | | |
sshpass -p ${{ secrets.PASSWORD }} ssh -o StrictHostKeyChecking=no ${{ secrets.USER_NAME }}@${{ secrets.SERVER_ADDRESS }} -p ${{ secrets.SSH_PORT }} << 'EOF' | |
echo ✅ SSH connection successful && | |
ls && | |
echo ✅ Listing directory && | |
echo wow && | |
if [ ! -d "/home/deployer/amgno.github.io" ]; then | |
echo ❌ Directory /home/deployer/amgno.github.io does not exist, creating it && | |
mkdir -p /home/deployer/amgno.github.io && | |
echo ✅ Directory created | |
fi && | |
cd /home/deployer/amgno.github.io && | |
echo ✅ Pulling from GitHub && | |
echo ${{ secrets.PASSWORD }} | sudo -S git fetch origin && | |
echo ${{ secrets.PASSWORD }} | sudo -S git reset --hard origin/main && | |
echo ${{ secrets.PASSWORD }} | sudo -S git clean -fd && | |
echo ${{ secrets.PASSWORD }} | sudo -S git pull && | |
echo ✅ Starting docker && | |
echo ${{ secrets.PASSWORD }} | sudo -S docker-compose down && | |
echo ${{ secrets.PASSWORD }} | sudo -S docker-compose up -d && | |
echo ✅ Done | |
EOF |