Files
nomad/.gitea/workflows/deploy.yaml
Preston Hunter 518aaab5f1 ci(deploy): Add 'newt' deploy option and make stack selection explicit
The `newt` stack has been added to the list of available deployment options for the Gitea Actions workflow.
Additionally, the default value for the `stack` input has been removed, making it a mandatory selection. This ensures that users explicitly choose which service to deploy, preventing unintended deployments and improving clarity.
2025-12-28 23:09:24 -05:00

68 lines
2.0 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:
type: choice
options:
# Just list the filenames (without .nomad)
- ai-backend
- ai-frontend
- newt
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Nomad CLI (Universal)
run: |
# 1. Detect Architecture (amd64 or arm64)
ARCH="amd64"
if [ "$(uname -m)" = "aarch64" ]; then ARCH="arm64"; fi
echo "Detected architecture: $ARCH"
# 2. Install Unzip (Required for HashiCorp files)
apt-get update && apt-get install -y unzip curl
# 3. Download Nomad 1.9.2
NOMAD_VER="1.9.2"
curl -L -o nomad.zip "https://releases.hashicorp.com/nomad/${NOMAD_VER}/nomad_${NOMAD_VER}_linux_${ARCH}.zip"
# 4. Install
unzip nomad.zip
mv nomad /usr/local/bin/
chmod +x /usr/local/bin/nomad
# 5. Verify
nomad --version
- 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"