name: Docker image builds on: workflow_dispatch: push: branches: ["main"] tags: ["v*"] env: DOCKER_METADATA_SET_OUTPUT_ENV: "true" permissions: contents: read packages: write attestations: write id-token: write pull-requests: write jobs: ko_prod: runs-on: ubuntu-24.04 steps: - name: Checkout code uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: fetch-tags: true fetch-depth: 0 persist-credentials: false - name: build essential run: | sudo apt-get update sudo apt-get install -y build-essential brotli zstd - name: Set lowercase image name run: | echo "IMAGE=ghcr.io/${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 with: node-version: "24.15.0" - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 with: go-version: "stable" - uses: actions-rust-lang/setup-rust-toolchain@ecabd13d1c56bd1345c230e542e9144811ad706f # v2.0.0 with: cache: false target: wasm32-unknown-unknown - name: Setup `wasmtime` uses: bytecodealliance/actions/wasmtime/setup@9152e710e9f7182e4c29ad218e4f335a7b203613 # v1.1.3 - uses: ko-build/setup-ko@61b4d1d396f5b2e7d6bb6fefdce3dc38d1a13445 # v0.10 - name: Log into registry uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Docker meta id: meta uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0 with: images: ${{ env.IMAGE }} flavor: | latest=false tags: | type=ref,event=branch type=ref,event=tag type=raw,value=latest,enable=${{ github.ref_type == 'tag' && !contains(github.ref_name, '-pre') }} type=raw,value=pre,enable=${{ github.ref_type == 'tag' && contains(github.ref_name, '-pre') }} - name: Build and push id: build run: | npm ci npm run container env: DOCKER_REPO: ${{ env.IMAGE }} SLOG_LEVEL: debug - name: Generate artifact attestation uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2 with: subject-name: ${{ env.IMAGE }} subject-digest: ${{ steps.build.outputs.digest }} push-to-registry: true