Skip to content

Bump docker/build-push-action from 5 to 6 #80

Bump docker/build-push-action from 5 to 6

Bump docker/build-push-action from 5 to 6 #80

Workflow file for this run

---
name: 05 Build and Comment
on:
push:
branches:
- main
pull_request:
jobs:
build-image:
name: Build Images
runs-on: ubuntu-latest
#NEW: (START) ##########################################################
permissions:
pull-requests: write # needed to create and update comments in PRs
#NEW: (END) ############################################################
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v5
with:
images: bretfisher/docker-ci-automation
flavor: |
latest=false
tags: |
type=raw,value=05
type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }}
type=ref,event=pr
type=ref,event=branch
type=semver,pattern={{version}}
- name: Docker build
uses: docker/build-push-action@v6
with:
push: false # false for this demo to prevent overwriting image tags of other examples
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64,linux/arm/v7
#NEW: (START) ##########################################################
# If PR, put image tags in the PR comments
# from https://github.com/marketplace/actions/create-or-update-comment
- name: Find comment for image tags
uses: peter-evans/find-comment@v3
if: github.event_name == 'pull_request'
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Docker image tag(s) pushed
# If PR, put image tags in the PR comments
- name: Create or update comment for image tags
uses: peter-evans/create-or-update-comment@v4
if: github.event_name == 'pull_request'
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
Docker image tag(s) pushed:
```text
${{ steps.docker_meta.outputs.tags }}
```
Labels added to images:
```text
${{ steps.docker_meta.outputs.labels }}
```
edit-mode: replace
#NEW: (END) ############################################################