Setup Github auto-deploy
This commit is contained in:
parent
4ad756f4d9
commit
02c8e75f24
39
.github/workflows/deploy.yml
vendored
Normal file
39
.github/workflows/deploy.yml
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
name: Deploy MMO Server
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Deploy via SSH
|
||||
uses: appleboy/ssh-action@v1.0.3
|
||||
with:
|
||||
host: ${{ secrets.HOST }}
|
||||
username: ${{ secrets.USERNAME }}
|
||||
key: ${{ secrets.SSH_KEY }}
|
||||
port: 22
|
||||
script: |
|
||||
cd /home/amp/gso
|
||||
|
||||
git pull origin main
|
||||
|
||||
npm run install-all
|
||||
|
||||
pm2 delete gso-api gso-server || true
|
||||
|
||||
pm2 start /home/amp/gso/api/package.json --name "gso-api" --interpreter node -- run start
|
||||
|
||||
pm2 start /home/amp/gso/game-server/package.json --name "gso-server" --interpreter node -- run start
|
||||
|
||||
cd /home/amp/gso/client && npm run build
|
||||
|
||||
pm2 save
|
||||
|
||||
echo "Deployed!"
|
||||
@ -25,7 +25,7 @@ const server = http.createServer(app);
|
||||
|
||||
const io = new Server(server, {
|
||||
cors: {
|
||||
origin: "http://localhost:5173",
|
||||
origin: "*",
|
||||
methods: ["GET", "POST"],
|
||||
credentials: true,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user