diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..1910157 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -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!" diff --git a/game-server/src/index.js b/game-server/src/index.js index 748535b..e12dc65 100644 --- a/game-server/src/index.js +++ b/game-server/src/index.js @@ -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, },