Files
continuwuity/.gitea/workflows/deploy.yml
Henrik Jess Nielsen 678a4afe5e
Some checks failed
Deploy continuwuity to Nomad / nomad job run continuwuity (push) Failing after 59s
Nomad changes again
2026-06-29 16:28:14 +02:00

87 lines
2.8 KiB
YAML
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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: Mirror image to registry.i80.dk
env:
UPSTREAM: forgejo.ellis.link/continuwuation/continuwuity:latest
IMAGE: registry.i80.dk/continuwuity
REGISTRY: registry.i80.dk
REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
run: |
if ! command -v docker >/dev/null 2>&1; then
echo "❌ docker not found on the runner — needed to mirror the image."
exit 1
fi
if [ -n "$REGISTRY_USER" ]; then
echo "$REGISTRY_PASSWORD" | docker login "$REGISTRY" -u "$REGISTRY_USER" --password-stdin
else
echo " REGISTRY_USER not set — assuming anonymous/pre-configured push to $REGISTRY"
fi
docker pull "$UPSTREAM"
docker tag "$UPSTREAM" "$IMAGE:latest"
docker tag "$UPSTREAM" "$IMAGE:${{ github.sha }}"
docker push "$IMAGE:latest"
docker push "$IMAGE:${{ github.sha }}"
echo "✅ mirrored $UPSTREAM -> $IMAGE:latest (+ :${{ github.sha }} for rollback)"
- 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