Skip to content

Create image

Create image #9

Workflow file for this run

name: Create image
on: workflow_dispatch
permissions:
contents: write
packages: write
checks: write
attestations: write
id-token: write
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push with Bake
id: bake
uses: docker/bake-action@v7
with:
files: docker-bake.hcl
targets: hugot-ghcr
push: true
- name: Extract image digest
id: extract_digest
run: |
echo "DIGEST=$(jq -r '.[] | select(.tags[] | contains(\"ghcr.io/knights-analytics/hugot\")) | .digest' <<< '${{ steps.bake.outputs.metadata }}')" >> $GITHUB_OUTPUT
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ghcr.io/knights-analytics/hugot
subject-digest: ${{ steps.extract_digest.outputs.DIGEST }}
push-to-registry: true