Skip to content

ci: add actionlint and a test-environment guard #117

ci: add actionlint and a test-environment guard

ci: add actionlint and a test-environment guard #117

Workflow file for this run

name: Docker publish
on:
push:
tags:
- "v*"
pull_request:
paths:
- "Dockerfile"
- ".dockerignore"
- "pyproject.toml"
- "src/**"
- "schemas/**"
- ".github/workflows/docker.yml"
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
permissions:
contents: read
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write # keyless cosign signing + provenance attestation (OIDC)
attestations: write # actions/attest-build-provenance
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Log in to GitHub Container Registry
if: startsWith(github.ref, 'refs/tags/')
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.0.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract tag name
if: startsWith(github.ref, 'refs/tags/')
id: tag
run: echo "tag=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
- name: Build and push
id: build
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.0.0
with:
context: .
push: ${{ startsWith(github.ref, 'refs/tags/') }}
tags: |
ghcr.io/agentrust-io/cmcp-gateway:${{ steps.tag.outputs.tag || github.sha }}
ghcr.io/agentrust-io/cmcp-gateway:latest
- name: Install cosign
if: startsWith(github.ref, 'refs/tags/')
uses: sigstore/cosign-installer@398d4b0eeef1380460a10c8013a76f728fb906ac # v3.10.1
- name: Sign the image (keyless, by digest)
if: startsWith(github.ref, 'refs/tags/')
env:
DIGEST: ${{ steps.build.outputs.digest }}
run: cosign sign --yes "ghcr.io/agentrust-io/cmcp-gateway@${DIGEST}"
- name: Attest build provenance (SLSA)
if: startsWith(github.ref, 'refs/tags/')
uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.0.0
with:
subject-name: ghcr.io/agentrust-io/cmcp-gateway
subject-digest: ${{ steps.build.outputs.digest }}
push-to-registry: true