Use Nomad dispatch - no custom code

This commit is contained in:
Christopher Mühl 2026-02-16 11:08:39 +01:00
parent 0933cf2bf5
commit fb906dab4e
No known key found for this signature in database
GPG key ID: 925AC7D69955293F

View file

@ -1,50 +1,45 @@
name: Deploy Site name: Deploy Site
description: Deploy a static site to production description: Deploy static site via Nomad dispatch
inputs: inputs:
site-name: site-name:
description: 'Site identifier (determines URL and deployment)' description: 'Site identifier'
required: true required: true
source-dir: source-dir:
description: 'Directory containing the built site' description: 'Directory containing built site'
required: false required: false
default: '.' default: '.'
runs: runs:
using: composite using: composite
steps: steps:
- name: Package site - name: Package artifact
shell: bash shell: bash
run: | run: |
echo "📦 Packaging ${{ inputs.site-name }}..."
cd "${{ inputs.source-dir }}" cd "${{ inputs.source-dir }}"
tar czf /tmp/${{ inputs.site-name }}.tar.gz . tar czf /tmp/${{ inputs.site-name }}.tar.gz .
echo "✓ Packaged $(du -h /tmp/${{ inputs.site-name }}.tar.gz | cut -f1)"
- name: Deploy via API - name: Upload artifact
shell: bash shell: bash
run: | run: |
echo "🚀 Deploying ${{ inputs.site-name }}..." ARTIFACT_URL="http://artifacts.intern.muehl.dev/${{ github.sha }}.tar.gz"
# TODO: Replace with actual deployment endpoint curl -X PUT \
# For now, use rsync + nomad dispatch --data-binary @/tmp/${{ inputs.site-name }}.tar.gz \
"$ARTIFACT_URL"
# Extract to deployment location echo "artifact_url=$ARTIFACT_URL" >> $GITHUB_OUTPUT
ssh deploy@alvin "mkdir -p /var/www/sites/${{ inputs.site-name }}"
scp /tmp/${{ inputs.site-name }}.tar.gz deploy@alvin:/tmp/
ssh deploy@alvin "cd /var/www/sites/${{ inputs.site-name }} && tar xzf /tmp/${{ inputs.site-name }}.tar.gz"
# Trigger deployment - name: Deploy via Nomad
ssh deploy@alvin "nomad job dispatch -meta site=${{ inputs.site-name }} deploy-site"
echo "✅ Deployed!"
- name: Show deployment info
shell: bash shell: bash
run: | run: |
echo "" nomad job dispatch static-site \
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" -meta site_name=${{ inputs.site-name }} \
echo "Site: ${{ inputs.site-name }}" -meta artifact_url=http://artifacts.intern.muehl.dev/${{ github.sha }}.tar.gz
echo "URL: https://${{ inputs.site-name }}.toph.so"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" - name: Summary
shell: bash
run: |
echo "✅ Deployed ${{ inputs.site-name }}"
echo "🌐 https://${{ inputs.site-name }}.toph.so"