add more feature #37
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 Ubuntu Server | |
on: | |
push: | |
branches: [main] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/[email protected] | |
with: | |
node-version: "18" | |
- name: Deploy to Server | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.SERVER_IP }} | |
username: ${{ secrets.SERVER_USER }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
script: | | |
echo "Connection successful" | |
cd /home/${{ secrets.SERVER_USER }}/www/fwqgo | |
pm2 stop ecosystem.config.cjs | |
rm -rf node_modules | |
rm -rf .next | |
echo "remove success" | |
git pull origin main | |
echo "git pull successfiul" | |
echo "DATABASE_URL=${{ secrets.DATABASE_URL }}" >> .env | |
echo "set DATABASE_URL" | |
npm install | |
npm run build | |
pm2 start ecosystem.config.cjs | |
echo "pm2 start success" |