familyfedie-website/.forgejo/workflows/deploy.yml
Loyyd 2b450f0275
Some checks failed
/ deploy (push) Failing after 0s
new deployment
2026-06-11 16:31:37 +02:00

50 lines
1.4 KiB
YAML

on:
push:
branches: [main]
workflow_dispatch:
concurrency:
group: deploy-main
cancel-in-progress: true
jobs:
deploy:
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 24
cache: npm
- name: Install dependencies
run: npm ci
- name: Build Astro static site
run: |
rm -rf dist
npm run build
- name: Verify static output
run: |
test -f dist/index.html
test -f dist/speeches/index.html
test -f dist/assets/icons/familyfed-favicon.png
- name: Restart Nomad allocation
env:
NOMAD_ADDR: ${{ secrets.NOMAD_ADDR }}
NOMAD_TOKEN: ${{ secrets.NOMAD_TOKEN }}
run: |
set -e
ALLOC_ID=$(curl -sf \
-H "X-Nomad-Token: $NOMAD_TOKEN" \
"$NOMAD_ADDR/v1/job/familyfed/allocations" \
| python3 -c "import sys,json; allocs=json.load(sys.stdin); print(next(a['ID'] for a in allocs if a['ClientStatus']=='running'))")
echo "Stopping allocation to trigger fresh prestart: $ALLOC_ID"
curl -sf -X POST \
-H "X-Nomad-Token: $NOMAD_TOKEN" \
"$NOMAD_ADDR/v1/allocation/$ALLOC_ID/stop"
echo "Deploy triggered — Nomad will schedule a new alloc that re-fetches the site."