BuildImage #12
This file contains 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: BuildImage | |
on: | |
push: | |
tags: | |
- 'c*.*.*' | |
workflow_dispatch: | |
inputs: | |
cmake-version: | |
description: 'CMake version' | |
required: true | |
default: '3.30.2' | |
permissions: # added using https://github.com/step-security/secure-workflows | |
contents: read | |
jobs: | |
build_multi_arch_images: | |
runs-on: ubuntu-latest | |
outputs: | |
digest: ${{ steps.docker_build.outputs.digest }} | |
steps: | |
# Extract version for docker tag | |
- name: Get version | |
run: | | |
if [ -z "${{ github.event.inputs.cmake-version }}" ]; then | |
echo "CMAKE_VERSION=${GITHUB_REF##*/}" | sed s/c// >> $GITHUB_ENV | |
else | |
echo "CMAKE_VERSION=${{ github.event.inputs.cmake-version }}" >> $GITHUB_ENV | |
fi | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1 | |
- name: Login to DockerHub | |
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push Multi Arch buildimage | |
id: docker_build | |
uses: docker/build-push-action@5176d81f87c23d6fc96624dfdbcd9f3830bbe445 # v6.5.0 | |
with: | |
file: ./Dockerfile | |
build-args: CMAKE_VERSION=${{ env.CMAKE_VERSION }} | |
push: true | |
provenance: true | |
tags: | | |
atsigncompany/cbuildimage:latest | |
atsigncompany/cbuildimage:GHA_${{ github.run_number }} | |
atsigncompany/cbuildimage:CMake-${{ env.CMAKE_VERSION }} | |
platforms: | | |
linux/amd64 | |
linux/arm64/v8 | |
slsa_provenance: | |
needs: [build_multi_arch_images] | |
permissions: | |
actions: read # for detecting the Github Actions environment. | |
id-token: write # for creating OIDC tokens for signing. | |
packages: write # for uploading attestations. | |
uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected] | |
with: | |
image: "atsigncompany/cbuildimage" | |
digest: ${{ needs.build_multi_arch_images.outputs.digest }} | |
secrets: | |
registry-username: ${{ secrets.DOCKERHUB_USERNAME }} | |
registry-password: ${{ secrets.DOCKERHUB_TOKEN }} |