Skip to content

chore(deps): update docker/build-push-action action to v4 #437

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

chore(deps): update docker/build-push-action action to v4 #437

Workflow file for this run

name: Build & Push to container registry
on:
release:
types: [created]
push:
branches:
- "**"
pull_request:
branches:
- "**"
paths:
- "Dockerfile"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check Out Repo
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3.2.0
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@8c0edbc76e98fa90f69d9a2c020dcb50019dc325 # v2.2.1
- name: Login to GitHub Container Registry
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
if: ${{ github.event_name != 'pull_request' }}
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract tag name
id: tags
if: ${{ github.event_name == 'release' }}
run: echo ::set-output name=name::${GITHUB_REF##*/}
- name: Extract flavor
id: flavor
run: if [ "${{ github.event_name }}" = "release" ]; then echo ::set-output name=name::; else echo ::set-output name=name::-dev; fi
- name: Generate Docker image metadata
uses: docker/metadata-action@57396166ad8aefe6098280995947635806a0e6ea # v4.1.1
id: img_meta
with:
flavor: |
latest=auto
suffix=${{ steps.flavor.outputs.name }}
images: ghcr.io/nezuchan/nezly
tags: |
${{ steps.tags.outputs.name }}
latest
- name: Build and push
id: docker_build
uses: docker/build-push-action@4e4ee680f69700760d5620a94c020aef883043aa # v4.2.0
with:
context: ./
tags: ${{ steps.img_meta.outputs.tags }}
labels: ${{ steps.img_meta.outputs.labels }}
push: ${{ github.event_name != 'pull_request' }}
cache-from: type=gha,mode=max
cache-to: type=gha,mode=max