Skip to content

ci: generate separate arm64 artifact attestation #6

ci: generate separate arm64 artifact attestation

ci: generate separate arm64 artifact attestation #6

Workflow file for this run

name: Publish Docker image
on:
push:
branches:
- master
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
attestations: write
id-token: write
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: sjdonado/url-shortener
- name: Build and push Docker image for amd64
id: push-amd64
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}-amd64
labels: ${{ steps.meta.outputs.labels }}
platform: linux/amd64
- name: Build and push Docker image for arm64
id: push-arm64
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}-arm64
labels: ${{ steps.meta.outputs.labels }}
platform: linux/arm64
- name: Generate artifact attestation for amd64
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.tags }}-amd64
subject-digest: ${{ steps.push-amd64.outputs.digest }}
push-to-registry: true
- name: Generate artifact attestation for arm64
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.tags }}-arm64
subject-digest: ${{ steps.push-arm64.outputs.digest }}
push-to-registry: true