Some checks failed
Deploy continuwuity to Nomad / nomad job run continuwuity (push) Has been cancelled
63 lines
1.7 KiB
YAML
63 lines
1.7 KiB
YAML
name: Deploy continuwuity to Nomad
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- 'continuwuity.hcl'
|
|
- '.gitea/workflows/deploy.yml'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
deploy:
|
|
name: nomad job run continuwuity
|
|
runs-on: debian-host
|
|
|
|
env:
|
|
NOMAD_ADDR: https://nomad.i80.dk
|
|
NOMAD_TOKEN: ${{ secrets.NOMAD_TOKEN }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Check nomad CLI
|
|
run: |
|
|
if ! command -v nomad >/dev/null 2>&1; then
|
|
echo "❌ nomad CLI not found on the runner (debian-host). Install it on the runner host."
|
|
exit 1
|
|
fi
|
|
nomad version
|
|
|
|
- name: Check Nomad connection
|
|
run: |
|
|
if [ -z "$NOMAD_ADDR" ]; then
|
|
echo "❌ NOMAD_ADDR secret is empty/unset — nomad would fall back to http://127.0.0.1:4646."
|
|
echo " Set repo secrets NOMAD_ADDR and NOMAD_TOKEN in Gitea → Settings → Actions → Secrets."
|
|
exit 1
|
|
fi
|
|
echo "→ NOMAD_ADDR=$NOMAD_ADDR"
|
|
# Fails clearly if the runner can't reach the Nomad API (network/token).
|
|
nomad node status >/dev/null
|
|
|
|
- name: Validate job
|
|
run: nomad job validate continuwuity.hcl
|
|
|
|
- name: Plan (diff, non-blocking)
|
|
run: |
|
|
# plan exit codes: 0 = no changes, 1 = changes will be made, anything else = error
|
|
set +e
|
|
nomad job plan continuwuity.hcl
|
|
code=$?
|
|
set -e
|
|
if [ "$code" -gt 1 ]; then
|
|
echo "❌ nomad job plan failed (exit $code)"
|
|
exit "$code"
|
|
fi
|
|
echo "✅ plan ok (exit $code)"
|
|
|
|
- name: Run
|
|
run: nomad job run continuwuity.hcl
|
|
|
|
- name: Status
|
|
run: nomad job status continuwuity
|