Skip to content

Bump docker/metadata-action from 4.6.0 to 5.3.0 #195

Bump docker/metadata-action from 4.6.0 to 5.3.0

Bump docker/metadata-action from 4.6.0 to 5.3.0 #195

name: build & publish docker image
on:
push:
schedule:
# every sunday at midnight
- cron: '0 0 * * 0'
workflow_dispatch:
env:
IMAGE_NAME: dotwee/fritzbox-prometheus-exporter
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Install the cosign tool except on PR
# https://github.com/sigstore/cosign-installer
- name: Install cosign
uses: sigstore/[email protected]
with:
cosign-release: 'v1.6.0'
- name: Setup QEMU binaries
uses: docker/[email protected]
- name: Setup Docker buildx
uses: docker/[email protected]
with:
buildkitd-flags: --debug
- name: Log into Docker Hub
uses: docker/[email protected]
with:
username: dotwee
password: ${{ secrets.DOCKER_REGISTRY_TOKEN }}
- name: Log into GitHub registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/[email protected]
with:
images: |
${{ env.IMAGE_NAME }}
ghcr.io/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
flavor: |
latest=true
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/[email protected]
with:
build-args: REPO=${{ github.repository }}
context: .
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
# // SET IMAGE SIGNING ON ICE UNTIL DOCKERHUB'S KEYSTORE GETS FIXED //
# Sign the resulting Docker image digest except on PRs.
# This will only write to the public Rekor transparency log when the Docker
# repository is public to avoid leaking data. If you would like to publish
# transparency data even for private images, pass --force to cosign below.
# https://github.com/sigstore/cosign
# - name: Sign the published Docker image
# env:
# COSIGN_EXPERIMENTAL: "true"
# # This step uses the identity token to provision an ephemeral certificate
# # against the sigstore community Fulcio instance.
# run: cosign sign ${{ env.IMAGE_NAME }}@${{ steps.build-and-push.outputs.digest }}