47 lines
1.2 KiB
YAML
47 lines
1.2 KiB
YAML
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/
|