Skip to content

Merge pull request #2 from agentage/feature/ui-update-header #11

Merge pull request #2 from agentage/feature/ui-update-header

Merge pull request #2 from agentage/feature/ui-update-header #11

Workflow file for this run

name: Deploy to Hetzner
on:
push:
branches:
- main
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_BACKEND: ghcr.io/agentage/web/backend
IMAGE_FRONTEND: ghcr.io/agentage/web/frontend
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for backend
id: meta-backend
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_BACKEND }}
tags: |
type=ref,event=branch
type=sha,prefix={{branch}}-
type=raw,value=latest,enable={{is_default_branch}}
- name: Extract metadata for frontend
id: meta-frontend
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_FRONTEND }}
tags: |
type=ref,event=branch
type=sha,prefix={{branch}}-
type=raw,value=latest,enable={{is_default_branch}}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push backend
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
target: backend
push: true
tags: ${{ steps.meta-backend.outputs.tags }}
labels: ${{ steps.meta-backend.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build and push frontend
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
target: frontend
push: true
tags: ${{ steps.meta-frontend.outputs.tags }}
labels: ${{ steps.meta-frontend.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
deploy:
needs: build-and-push
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
environment: development
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup SSH
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Deploy Application
id: deploy
uses: ./.github/workflows/actions/deploy-application
with:
environment: 'development'
compose-file: 'docker-compose.yml'
domain-name: ${{ vars.SSH_HOST || secrets.SSH_HOST }}
frontend-fqdn: ${{ vars.FRONTEND_FQDN || 'dev.agentage.io' }}
api-fqdn: ${{ vars.API_FQDN || 'api.dev.agentage.io' }}
server-user: ${{ vars.SSH_USERNAME || secrets.SSH_USERNAME }}
github-token: ${{ secrets.GITHUB_TOKEN }}
image-tag: 'latest'
secrets-json: ${{ secrets.APP_SECRETS_JSON || '{}' }}
wait-for-healthy: 'false'
- name: Deployment Status
run: |
echo "✅ Deployment completed successfully!"
echo "Environment: development"
echo "Services: ${{ steps.deploy.outputs.deployed-services }}"
echo "URL: ${{ steps.deploy.outputs.deployment-url }}"
echo "Status: ${{ steps.deploy.outputs.deployment-status }}"