dploy #35
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 to Server | |
on: | |
push: | |
branches: | |
- develop | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Deploy to Server | |
uses: appleboy/ssh-action@master | |
with: | |
host: ec2-54-207-67-252.sa-east-1.compute.amazonaws.com | |
username: ubuntu | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
port: 22 | |
script: | | |
# Print working directory and list files | |
pwd | |
ls -l | |
# Verify node and npm versions | |
/home/ubuntu/.nvm/versions/node/v20.13.1/bin/node --version | |
/home/ubuntu/.nvm/versions/node/v20.13.1/bin/npm --version | |
# Navigate to the project directory | |
cd /home/ubuntu/frontend/WallDreams | |
# Pull the latest code from the develop branch | |
git pull origin develop | |
# Install dependencies | |
/home/ubuntu/.nvm/versions/node/v20.13.1/bin/npm install | |
# Build the project | |
/home/ubuntu/.nvm/versions/node/v20.13.1/bin/npm run build | |
# Restart nginx service | |
sudo systemctl restart nginx |