69 lines
2.8 KiB
YAML
69 lines
2.8 KiB
YAML
name: Build and Deploy
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: https://gitea.com/actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to Gitea Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ secrets.REGISTRY_URL }}
|
|
username: ${{ secrets.REGISTRY_USER }}
|
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
|
|
- name: Build and push postgres image
|
|
uses: docker/build-push-action@v5
|
|
# if: |
|
|
# contains(github.event.commits[0].modified, 'infra/docker/postgres-pg-cron') ||
|
|
# contains(github.event.commits[0].added, 'infra/docker/postgres-pg-cron')
|
|
with:
|
|
context: .
|
|
file: infra/docker/postgres-pg-cron/Dockerfile
|
|
push: true
|
|
tags: |
|
|
${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USER }}/familyhub-postgres:latest
|
|
${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USER }}/familyhub:${{ github.sha }}
|
|
cache-from: type=registry,ref=${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USER }}/familyhub:cache
|
|
cache-to: type=registry,ref=${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USER }}/familyhub:cache,mode=max
|
|
|
|
# - name: Build and push webhook image
|
|
# uses: docker/build-push-action@v5
|
|
# with:
|
|
# context: .
|
|
# file: infra/webhook/Dockerfile
|
|
# push: true
|
|
# tags: |
|
|
# ${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USER }}/familyhub-webhook:latest
|
|
# ${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USER }}/familyhub:${{ github.sha }}
|
|
# cache-from: type=registry,ref=${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USER }}/familyhub:cache
|
|
# cache-to: type=registry,ref=${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USER }}/familyhub:cache,mode=max
|
|
|
|
- name: Build and push app image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: infra/application/Dockerfile
|
|
push: true
|
|
tags: |
|
|
${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USER }}/familyhub:latest
|
|
${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USER }}/familyhub:${{ github.sha }}
|
|
cache-from: type=registry,ref=${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USER }}/familyhub:cache
|
|
cache-to: type=registry,ref=${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USER }}/familyhub:cache,mode=max
|
|
|
|
# - name: Trigger deploy
|
|
# run: |
|
|
# curl -s -X POST \
|
|
# -H "X-Webhook-Secret: ${{ secrets.WEBHOOK_SECRET }}" \
|
|
# "http://10.0.0.2:9001/deploy?container=familyhub" |