on:
workflow_call:
inputs:
ref:
required: true
type: string
repo:
required: true
type: string
secrets:
SIGNING_SECRET:
required: true
description: The cosign private key used to sign images
env:
FORCE_COLOR: 1
CLICOLOR_FORCE: 1
RUST_LOG_STYLE: always
permissions: {}
jobs:
arm64-prebuild:
timeout-minutes: 20
runs-on: ubuntu-24.04-arm
permissions:
packages: write
steps:
- uses: earthly/actions-setup@43211c7a0eae5344d6d79fb4aaf209c8f8866203 with:
use-cache: false
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd with:
persist-credentials: false
fetch-depth: 0
ref: ${{ inputs.ref }}
repository: ${{ inputs.repo }}
- name: Login to GitHub Container Registry
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Run build
id: build
run: |
earthly --ci --push -P +prebuild
amd64-prebuild:
timeout-minutes: 20
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- uses: earthly/actions-setup@43211c7a0eae5344d6d79fb4aaf209c8f8866203 with:
use-cache: false
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd with:
persist-credentials: false
fetch-depth: 0
ref: ${{ inputs.ref }}
repository: ${{ inputs.repo }}
- name: Login to GitHub Container Registry
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Run build
id: build
run: |
earthly --ci --push -P +prebuild
build-images:
permissions:
packages: write timeout-minutes: 60
runs-on: ubuntu-latest
outputs:
digests: ${{ steps.image_manifest_metadata.outputs.digests }}
needs:
- arm64-prebuild
- amd64-prebuild
steps:
- name: Maximize build space
uses: ublue-os/remove-unwanted-software@cc0becac701cf642c8f0a6613bbdaf5dc36b259e
- uses: earthly/actions-setup@43211c7a0eae5344d6d79fb4aaf209c8f8866203 with:
use-cache: false
- name: Set up QEMU
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd with:
persist-credentials: false
fetch-depth: 0
ref: ${{ inputs.ref }}
repository: ${{ inputs.repo }}
- name: Login to GitHub Container Registry
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Run build
env:
GH_ACTOR: ${{ github.actor }}
GH_TOKEN: ${{ github.token }}
COSIGN_PRIVATE_KEY: ${{ secrets.SIGNING_SECRET }}
run: |
earthly \
--secret COSIGN_PRIVATE_KEY \
--secret GH_ACTOR \
--secret GH_TOKEN \
--push --ci -P +build-images-all
earthly \
--artifact +sign-all/digest-list ./digest-list
- name: Store image digest info
id: image_manifest_metadata
run: |
digest_list_json=$(jq -Rc '[ inputs | split(",") | {"image_ref":.[0],"image_digest":.[1]} ]' ./digest-list)
echo "digests=$digest_list_json" >> $GITHUB_OUTPUT
provenance:
needs: [build-images]
permissions:
actions: read id-token: write packages: write strategy:
matrix:
include: ${{ fromJson(needs.build-images.outputs.digests) }}
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_container_slsa3.yml@v2.1.0
with:
image: ${{ matrix.image_ref }}
digest: ${{ matrix.image_digest }}
registry-username: ${{ github.actor }}
secrets:
registry-password: ${{ secrets.GITHUB_TOKEN }}