Skip to content

chore(deps): update docker/build-push-action action to v6 #15

chore(deps): update docker/build-push-action action to v6

chore(deps): update docker/build-push-action action to v6 #15

Workflow file for this run

name: build & publish Docker image
on:
push:
branches:
- main
jobs:
lint-test:
name: lint & test
uses: './.github/workflows/lint-test.yml'
build-publish:
name: build & publish Docker image
needs:
- lint-test
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: set up Docker buildx
uses: docker/setup-buildx-action@v3
- name: log into the GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: compute Docker image tag
id: docker-tags
# todo [breaking]: remove commit hash from tag? there is the OCI metadata annotation `org.opencontainers.image.revision`
run: |
oci_version="v3-$(date +"%Y-%m-%dT%H.%M.%S")"
echo "oci-version=$oci_version" >>$GITHUB_OUTPUT
echo "permanent-tag=$oci_version-${GITHUB_SHA:0:7}" >>$GITHUB_OUTPUT
- name: compute Docker image OCI metadata from commit & repo
id: docker-metadata
uses: docker/metadata-action@v5
with:
labels: |
org.opencontainers.image.version=${{ steps.docker-tags.outputs.oci-version }}
- name: build and push Docker image
uses: docker/build-push-action@v6
with:
push: true
tags: |
ghcr.io/${{ github.repository }}:v3
ghcr.io/${{ github.repository }}:${{ steps.docker-tags.outputs.permanent-tag }}
labels: ${{ steps.docker-metadata.outputs.labels }}
platforms: linux/amd64
# https://docs.docker.com/build/ci/github-actions/cache/#cache-backend-api
cache-from: type=gha
cache-to: type=gha,mode=max