infra/roles/app_deployer/files/forgejo-deploy-workflow.yml
Jeremie Fraeys b9c5cdff12
Add app deployer role for automated deployments
- Systemd service and timer for deployment orchestration
- Webhook listener for Git-triggered deployments
- Forgejo Actions workflow for CI/CD pipeline
- Deployment scripts with rollback capability
- Deploy token validation for security
2026-02-21 18:31:12 -05:00

44 lines
1.4 KiB
YAML

# Sample Forgejo Actions workflow for app deployment
# Copy this to your app repo: .forgejo/workflows/deploy.yml
on:
push:
branches: [main]
jobs:
build-and-deploy:
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
- name: Build binary
run: |
# Replace with your build command (Go, Rust, Node.js, etc.)
go build -o my-api ./cmd/...
# or: cargo build --release
# or: npm run build
- name: Generate artifact checksum
run: |
sha256sum my-api > my-api.sha256
# Rename binary to include version
mv my-api my-api-${{ github.sha }}
# Update checksum file with new name
sha256sum my-api-${{ github.sha }} > my-api-${{ github.sha }}.sha256
- name: Upload artifact and checksum to web host
run: |
# Upload both binary and checksum
scp my-api-${{ github.sha }} my-api-${{ github.sha }}.sha256 deploy@web:/opt/artifacts/
- name: Trigger deployment on web host
run: |
# Use HTTPS with valid certificate
curl -s -X POST https://web.jfraeys.com:9000/hooks/deploy \
-H "Content-Type: application/json" \
-H "X-Deploy-Token: ${{ secrets.DEPLOY_TOKEN }}" \
-d '{
"app": "my-api",
"version": "${{ github.sha }}",
"env": "prod"
}'