name: Deploy Feature on: push: branches: - feature-* jobs: deploy-feature: runs-on: pusher container: volumes: - /repos:/repos - /www/jeopardy-test:/www/jeopardy-test steps: - name: Install Node.js and npm run: | set -e apk add --no-cache nodejs npm node -v npm -v - name: Build app (feature) run: | set -euo pipefail BRANCH="${GITHUB_REF_NAME:-}" if [ -z "$BRANCH" ] && [ -n "${GITHUB_REF:-}" ]; then BRANCH="${GITHUB_REF#refs/heads/}" fi if [ -z "$BRANCH" ]; then echo "Unable to determine branch name." exit 1 fi cd /repos/music-jeopardy git fetch origin "$BRANCH" git checkout -B "$BRANCH" "origin/$BRANCH" npm ci --include=dev npm run generate:data npm run build - name: Deploy static files to test run: | set -euo pipefail mkdir -p /www/jeopardy-test find /www/jeopardy-test -mindepth 1 -maxdepth 1 -exec rm -rf {} + cp -r /repos/music-jeopardy/dist/. /www/jeopardy-test/ - name: Restart realtime service (if available) run: | set -e if command -v systemctl >/dev/null 2>&1; then systemctl daemon-reload systemctl enable --now music-jeopardy-realtime.service systemctl restart music-jeopardy-realtime.service else echo "systemctl not available in this runner container. Restart on host manually." fi