sync
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 40s

This commit is contained in:
2025-12-15 07:38:18 -08:00
parent 9b445546da
commit 6ce170e84a
3 changed files with 32 additions and 6 deletions

View File

@@ -12,6 +12,9 @@ jobs:
permissions:
contents: read
packages: write
outputs:
container_sha: ${{ github.sha }}
registry_url: ${{ steps.registry.outputs.url }}
steps:
- name: Checkout repository

View File

@@ -6,13 +6,18 @@ on:
types:
- completed
workflow_dispatch: # Allows manual triggering for testing
inputs:
container_sha:
description: 'Container SHA to deploy (leave empty for latest commit)'
required: false
type: string
jobs:
nomad:
runs-on: ubuntu-latest
name: Deploy to Nomad
# Only run if the build workflow succeeded
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
steps:
# 1. Checkout Code
@@ -25,13 +30,27 @@ jobs:
with:
version: '1.10.0' # Use your desired version or remove for 'latest'
# 3. Deploy the Nomad Job
# 3. Determine container version to deploy
- name: Set Container Version
id: container_version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ -n "${{ inputs.container_sha }}" ]; then
echo "sha=${{ inputs.container_sha }}" >> $GITHUB_OUTPUT
elif [ "${{ github.event_name }}" = "workflow_run" ]; then
echo "sha=${{ github.event.workflow_run.head_sha }}" >> $GITHUB_OUTPUT
else
echo "sha=${{ github.sha }}" >> $GITHUB_OUTPUT
fi
# 4. Deploy the Nomad Job
- name: Deploy Nomad Job
id: deploy
env:
# REQUIRED: Set the Nomad server address
NOMAD_ADDR: http://nomad.service.dc1.consul:4646
run: |
echo "Deploying container version: ${{ steps.container_version.outputs.sha }}"
nomad status
nomad job run fitbit-garmin-sync.nomad
nomad job run \
-var="container_version=${{ steps.container_version.outputs.sha }}" \
fitbit-garmin-sync.nomad