51 lines
1.4 KiB
YAML
51 lines
1.4 KiB
YAML
name: Deploy to Nomad
|
|
run-name: Deploy ${{ inputs.stack_name }} 🚀
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
stack_name:
|
|
description: 'Stack to deploy'
|
|
required: true
|
|
# Default can be anything, or leave empty
|
|
default: 'ai-backend'
|
|
type: choice
|
|
options:
|
|
# Just list the filenames (without .nomad)
|
|
- ai-backend
|
|
- ai-frontend
|
|
# - uptime-kuma (Add this later)
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Nomad
|
|
uses: hashicorp/setup-nomad@v3
|
|
with:
|
|
version: '1.9.2'
|
|
|
|
- name: Run Deploy
|
|
env:
|
|
NOMAD_ADDR: "http://192.168.1.133:4646"
|
|
run: |
|
|
STACK="${{ inputs.stack_name }}"
|
|
echo "Searching for $STACK.nomad..."
|
|
|
|
# 1. Find the file anywhere inside the 'stacks' folder
|
|
# This command looks in subfolders (ai, monitoring, etc) automatically
|
|
FILE_PATH=$(find stacks -name "$STACK.nomad" -print -quit)
|
|
|
|
if [ -z "$FILE_PATH" ]; then
|
|
echo "❌ Error: Could not find '$STACK.nomad' inside the 'stacks/' directory!"
|
|
echo "Double check that the menu option matches the filename exactly."
|
|
exit 1
|
|
fi
|
|
|
|
# 2. Deploy it
|
|
echo "✅ Found file at: $FILE_PATH"
|
|
echo "🚀 Sending to Nomad..."
|
|
nomad job run "$FILE_PATH" |