Skip to content

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

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

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

Workflow file for this run

name: Docker CI
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
on:
push:
branches: [main, staging]
tags:
- "v*"
pull_request:
branches: [main, staging]
workflow_dispatch:
release:
types: [published]
jobs:
build-and-push-docker-hub:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip ci')"
permissions:
contents: read
packages: write
steps:
- name: Checkout source repository
uses: actions/checkout@v4
- name: Docker meta base
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build base
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-and-push-ghcr:
env:
REGISTRY: ghcr.io
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip ci')"
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker image
id: metaghcr
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Build base and push
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.metaghcr.outputs.tags }}
labels: ${{ steps.metaghcr.outputs.labels }}