Use Nomad dispatch - no custom code
This commit is contained in:
parent
0933cf2bf5
commit
fb906dab4e
1 changed files with 20 additions and 25 deletions
|
|
@ -1,50 +1,45 @@
|
|||
name: Deploy Site
|
||||
description: Deploy a static site to production
|
||||
description: Deploy static site via Nomad dispatch
|
||||
|
||||
inputs:
|
||||
site-name:
|
||||
description: 'Site identifier (determines URL and deployment)'
|
||||
description: 'Site identifier'
|
||||
required: true
|
||||
|
||||
source-dir:
|
||||
description: 'Directory containing the built site'
|
||||
description: 'Directory containing built site'
|
||||
required: false
|
||||
default: '.'
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Package site
|
||||
- name: Package artifact
|
||||
shell: bash
|
||||
run: |
|
||||
echo "📦 Packaging ${{ inputs.site-name }}..."
|
||||
cd "${{ inputs.source-dir }}"
|
||||
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
|
||||
run: |
|
||||
echo "🚀 Deploying ${{ inputs.site-name }}..."
|
||||
ARTIFACT_URL="http://artifacts.intern.muehl.dev/${{ github.sha }}.tar.gz"
|
||||
|
||||
# TODO: Replace with actual deployment endpoint
|
||||
# For now, use rsync + nomad dispatch
|
||||
curl -X PUT \
|
||||
--data-binary @/tmp/${{ inputs.site-name }}.tar.gz \
|
||||
"$ARTIFACT_URL"
|
||||
|
||||
# Extract to deployment location
|
||||
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"
|
||||
echo "artifact_url=$ARTIFACT_URL" >> $GITHUB_OUTPUT
|
||||
|
||||
# Trigger deployment
|
||||
ssh deploy@alvin "nomad job dispatch -meta site=${{ inputs.site-name }} deploy-site"
|
||||
|
||||
echo "✅ Deployed!"
|
||||
|
||||
- name: Show deployment info
|
||||
- name: Deploy via Nomad
|
||||
shell: bash
|
||||
run: |
|
||||
echo ""
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo "Site: ${{ inputs.site-name }}"
|
||||
echo "URL: https://${{ inputs.site-name }}.toph.so"
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
nomad job dispatch static-site \
|
||||
-meta site_name=${{ inputs.site-name }} \
|
||||
-meta artifact_url=http://artifacts.intern.muehl.dev/${{ github.sha }}.tar.gz
|
||||
|
||||
- name: Summary
|
||||
shell: bash
|
||||
run: |
|
||||
echo "✅ Deployed ${{ inputs.site-name }}"
|
||||
echo "🌐 https://${{ inputs.site-name }}.toph.so"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue