space-game/.github/workflows/build.yml
2025-10-16 10:30:44 -05:00

40 lines
893 B
YAML

name: Build
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: linux_amd64
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
env:
NODE_OPTIONS: '--max-old-space-size=2048'
- name: Extract hostname from package.json
id: get-hostname
run: |
HOSTNAME=$(node -p "require('./package.json').deployHostname")
echo "hostname=$HOSTNAME" >> $GITHUB_OUTPUT
- name: Deploy to nginx
run: |
DEPLOY_PATH="/var/www/localhost/${{ steps.get-hostname.outputs.hostname }}"
# Create directory if it doesn't exist
mkdir -p "$DEPLOY_PATH"
# Copy built files (overwrite existing)
cp -r dist/* "$DEPLOY_PATH/"
echo "Deployed to $DEPLOY_PATH"