49 lines
1.3 KiB
YAML
49 lines
1.3 KiB
YAML
name: Deploy Master
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
jobs:
|
|
deploy-master:
|
|
runs-on: pusher
|
|
container:
|
|
volumes:
|
|
- /repos:/repos
|
|
- /www/jeopardy:/www/jeopardy
|
|
steps:
|
|
- name: Install Node.js and npm
|
|
run: |
|
|
set -e
|
|
apk add --no-cache nodejs npm
|
|
node -v
|
|
npm -v
|
|
|
|
- name: Build app (master)
|
|
run: |
|
|
set -euo pipefail
|
|
cd /repos/music-jeopardy
|
|
git fetch origin master
|
|
git checkout -B master origin/master
|
|
npm ci --include=dev
|
|
npm run generate:data
|
|
npm run build
|
|
|
|
- name: Deploy static files to production
|
|
run: |
|
|
set -euo pipefail
|
|
mkdir -p /www/jeopardy
|
|
find /www/jeopardy -mindepth 1 -maxdepth 1 -exec rm -rf {} +
|
|
cp -r /repos/music-jeopardy/dist/. /www/jeopardy/
|
|
- 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
|