publish #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: publish | |
| on: | |
| release: | |
| types: | |
| - published | |
| workflow_dispatch: | |
| inputs: | |
| image_tag: | |
| description: Tag OCI a publicar manualmente | |
| required: true | |
| default: manual | |
| type: string | |
| publish_latest: | |
| description: Atualizar tambem a tag latest | |
| required: true | |
| default: true | |
| type: boolean | |
| permissions: | |
| contents: read | |
| packages: write | |
| attestations: write | |
| id-token: write | |
| concurrency: | |
| group: publish-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| docker: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Baixa o repositorio para montar a imagem a partir do Dockerfile versionado. | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| # Habilita emulacao para publicar amd64 e arm64 a partir do runner padrao. | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v4 | |
| # Prepara o builder Buildx com suporte a multiplataforma e cache. | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| # Faz login no GHCR usando o token nativo do workflow, como recomendado pela documentacao do GitHub. | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v4 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| # Gera tags OCI a partir da release publicada para debugtools. | |
| - name: Extract Docker metadata for debugtools | |
| id: meta-debugtools | |
| uses: docker/metadata-action@v6 | |
| with: | |
| images: ghcr.io/${{ github.repository_owner }}/debugtools | |
| tags: | | |
| type=raw,value=${{ github.event.release.tag_name }},enable=${{ github.event_name == 'release' }} | |
| type=raw,value=${{ github.event.inputs.image_tag }},enable=${{ github.event_name == 'workflow_dispatch' }} | |
| type=raw,value=latest,enable=${{ github.event_name == 'release' && github.event.release.prerelease == false }} | |
| type=raw,value=latest,enable=${{ github.event_name == 'workflow_dispatch' && github.event.inputs.publish_latest == 'true' }} | |
| # Monta a imagem, roda o build multiplataforma e publica no GHCR para debugtools. | |
| - name: Build and push debugtools | |
| id: build-debugtools | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| platforms: linux/amd64,linux/arm64 | |
| pull: true | |
| push: true | |
| tags: ${{ steps.meta-debugtools.outputs.tags }} | |
| labels: ${{ steps.meta-debugtools.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| # Publica atestacao de proveniencia da imagem debugtools publicada no GHCR. | |
| - name: Attest build provenance for debugtools | |
| uses: actions/attest-build-provenance@v4 | |
| with: | |
| subject-name: ghcr.io/${{ github.repository_owner }}/debugtools | |
| subject-digest: ${{ steps.build-debugtools.outputs.digest }} | |
| push-to-registry: true | |
| # Gera tags OCI a partir da release publicada para debugtools-mcp. | |
| - name: Extract Docker metadata for debugtools-mcp | |
| id: meta-mcp | |
| uses: docker/metadata-action@v6 | |
| with: | |
| images: ghcr.io/${{ github.repository_owner }}/debugtools-mcp | |
| tags: | | |
| type=raw,value=${{ github.event.release.tag_name }},enable=${{ github.event_name == 'release' }} | |
| type=raw,value=${{ github.event.inputs.image_tag }},enable=${{ github.event_name == 'workflow_dispatch' }} | |
| type=raw,value=latest,enable=${{ github.event_name == 'release' && github.event.release.prerelease == false }} | |
| type=raw,value=latest,enable=${{ github.event_name == 'workflow_dispatch' && github.event.inputs.publish_latest == 'true' }} | |
| # Monta a imagem, roda o build multiplataforma e publica no GHCR para o mcp-server. | |
| - name: Build and push debugtools-mcp | |
| id: build-mcp | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: ./mcp-server | |
| file: ./mcp-server/Dockerfile | |
| platforms: linux/amd64,linux/arm64 | |
| pull: true | |
| push: true | |
| tags: ${{ steps.meta-mcp.outputs.tags }} | |
| labels: ${{ steps.meta-mcp.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| # Publica atestacao de proveniencia da imagem debugtools-mcp publicada no GHCR. | |
| - name: Attest build provenance for debugtools-mcp | |
| uses: actions/attest-build-provenance@v4 | |
| with: | |
| subject-name: ghcr.io/${{ github.repository_owner }}/debugtools-mcp | |
| subject-digest: ${{ steps.build-mcp.outputs.digest }} | |
| push-to-registry: true |