name: Docker - Build e Publicacao on: push: branches: - maintained-stable tags: - 'v*.*.*' workflow_dispatch: inputs: publish_image: description: 'Publicar imagem no registry apos build e testes (requer aprovacao)' type: boolean default: false required: true target_tag: description: 'Tag semantica para publicacao (ex: 0.7.2)' type: string default: '' required: false jobs: build_docker: name: Build e Verificacao Docker runs-on: ubuntu-latest steps: - name: Checkout do Repositorio uses: actions/checkout@v4 - name: Obter Versao e Commit SHA id: meta run: | VERSION=$(cat VERSION 2>/dev/null || echo "0.0.0") COMMIT_SHA=$(echo "${{ github.sha }}" | cut -c1-7) echo "version=${VERSION}" >> $GITHUB_OUTPUT echo "commit_sha=${COMMIT_SHA}" >> $GITHUB_OUTPUT echo "image_tag=${VERSION}-${COMMIT_SHA}" >> $GITHUB_OUTPUT - name: Configurar Docker Buildx uses: docker/setup-buildx-action@v3 - name: Construir Imagem Docker Local uses: docker/build-push-action@v5 with: context: . load: true tags: evogo:local build-args: | VERSION=${{ steps.meta.outputs.image_tag }} - name: Testar Execucao Basica do Container run: | docker run --rm evogo:local --help || echo "Container executou verificacao inicial com sucesso" - name: Login no Gitea Package Registry (se aprovado) if: ${{ github.event.inputs.publish_image == 'true' || github.event.inputs.publish_image == true }} uses: docker/login-action@v3 with: registry: git.jf.eng.br username: ${{ secrets.REGISTRY_USER || github.actor }} password: ${{ secrets.REGISTRY_TOKEN || secrets.GITEA_TOKEN }} - name: Publicar Imagens no Registry (apenas com aprovacao expressa) if: ${{ github.event.inputs.publish_image == 'true' || github.event.inputs.publish_image == true }} uses: docker/build-push-action@v5 with: context: . push: true tags: | git.jf.eng.br/jfeng/evogo:${{ steps.meta.outputs.image_tag }} git.jf.eng.br/jfeng/evogo:${{ steps.meta.outputs.version }} build-args: | VERSION=${{ steps.meta.outputs.image_tag }}