Skip to content

Merge branch 'master' of github.com:hacklabr/mapas-PA #332

Merge branch 'master' of github.com:hacklabr/mapas-PA

Merge branch 'master' of github.com:hacklabr/mapas-PA #332

Workflow file for this run

name: ci
on:
push:
tags:
- "v*.*.*"
branches:
- "master"
- "develop"
env:
# Define o nome da imagem apontando para o GHCR
# github.repository contém "dono/repositorio"
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
docker:
runs-on: ubuntu-latest
# 👷‍♂️ DevOps: Permissões necessárias para o GITHUB_TOKEN escrever no GHCR
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive # 🏛️ Architect: Maneira mais limpa de lidar com submodules
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# Configura as tags automaticamente baseadas no evento (branch ou tag semver)
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha,format=long # Útil para debug exato do commit
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# 👷‍♂️ DevOps: Cache nativo do GitHub Actions para acelerar o build
cache-from: type=gha
cache-to: type=gha,mode=max