52 lines
1.6 KiB
YAML
52 lines
1.6 KiB
YAML
name: Build and Deploy (Gitea Actions)
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
workflow_dispatch: {}
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: self-hosted
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to Gitea Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: gitea.microtecinformaticacurso.com.br
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITEA_TOKEN }}
|
|
|
|
- name: Build and push App
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
push: true
|
|
platforms: linux/arm64
|
|
tags: gitea.microtecinformaticacurso.com.br/${{ github.repository }}/agendapro-app:latest
|
|
|
|
- name: Build and push Admin
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: ./admin
|
|
push: true
|
|
platforms: linux/arm64
|
|
tags: gitea.microtecinformaticacurso.com.br/${{ github.repository }}/agendapro-admin:latest
|
|
|
|
- name: Atualizar Containers em Produção (Watchtower)
|
|
run: |
|
|
AUTH=$(echo -n "${{ github.actor }}:${{ secrets.GITEA_TOKEN }}" | base64 -w 0)
|
|
echo "{\"auths\": {\"gitea.microtecinformaticacurso.com.br\": {\"auth\": \"$AUTH\"}}}" > $(pwd)/registry-config.json
|
|
|
|
docker run --rm \
|
|
-v /var/run/docker.sock:/var/run/docker.sock \
|
|
-v $(pwd)/registry-config.json:/config.json \
|
|
containrrr/watchtower \
|
|
--run-once --cleanup --debug
|