34 lines
1.4 KiB
YAML
34 lines
1.4 KiB
YAML
name: deploy-railway
|
|
# Push-to-deploy for the CPU relay. Requires a project API token as the
|
|
# RAILWAY_TOKEN repo secret (dashboard: saw project -> Settings -> API
|
|
# tokens, scope: production environment). Without the secret the job skips
|
|
# and deploys stay manual (`make relay`).
|
|
# NOTE: the wirehead X bot lives in terrafying/wirehead-bot (separate Railway
|
|
# project "wirehead") — never deploy it from this workflow.
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
concurrency:
|
|
group: deploy-railway-${{ github.ref }}
|
|
cancel-in-progress: false
|
|
jobs:
|
|
relay:
|
|
if: github.repository == 'terrafying/ai-torture-chamber'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Deploy CPU relay (live/) when live/** changed
|
|
env:
|
|
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}
|
|
run: |
|
|
if [ -z "$RAILWAY_TOKEN" ]; then echo "no RAILWAY_TOKEN secret - skipping"; exit 0; fi
|
|
# GITHUB_EVENT_BEFORE is empty on some push events; treat that as
|
|
# "deploy" rather than erroring on a bad revision
|
|
if [ -z "$GITHUB_EVENT_BEFORE" ] || ! git diff --quiet "$GITHUB_EVENT_BEFORE" "$GITHUB_SHA" -- live/ 2>/dev/null; then
|
|
npx -y @railway/cli@latest up --project 11f1d169-3b88-40e7-a054-f4b79e89c138 \
|
|
--environment e1abb91d-1146-4601-aabf-cfb9a8eef2b2 \
|
|
--service saw --detach live
|
|
else
|
|
echo "live/ unchanged - skip"
|
|
fi
|