Skip to content

Commit 063f5d7

Browse files
authored
Update docker-ghcr.yml
1 parent 1e48bef commit 063f5d7

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

.github/workflows/docker-ghcr.yml

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,57 @@
1-
name: Docker
2-
1+
---
2+
name: GHCR Publish
33
# This workflow uses actions that are not certified by GitHub.
44
# They are provided by a third-party and are governed by
55
# separate terms of service, privacy policy, and support
66
# documentation.
7-
87
on:
98
push:
10-
branches: [ "main" ]
11-
# Publish semver tags as releases.
12-
tags: [ '*.*.*' ]
9+
branches: [main]
10+
tags: [*.*.*]
11+
release:
12+
types: [published]
13+
workflow_dispatch:
1314

1415
env:
1516
# Use docker.io for Docker Hub if empty
1617
REGISTRY: ghcr.io
1718
# github.repository as <account>/<repo>
1819
IMAGE_NAME: ${{ github.repository }}
19-
20-
2120
jobs:
2221
build:
23-
2422
runs-on: ubuntu-latest
2523
permissions:
2624
contents: read
2725
packages: write
2826
# This is used to complete the identity challenge
2927
# with sigstore/fulcio when running outside of PRs.
3028
id-token: write
31-
3229
steps:
3330
- name: Checkout repository
34-
uses: actions/checkout@v3
31+
uses: actions/checkout@v4
3532

3633
# Install the cosign tool except on PR
3734
# https://github.com/sigstore/cosign-installer
3835
- name: Install cosign
3936
if: github.event_name != 'pull_request'
4037
uses: sigstore/[email protected]
4138
with:
42-
cosign-release: 'v2.1.1'
39+
cosign-release: v2.1.1
4340

41+
# Using QEME for multiple platforms
42+
# https://github.com/docker/build-push-action?tab=readme-ov-file#usage
43+
- name: Set up QEMU
44+
uses: docker/setup-qemu-action@v3
4445

4546
# Workaround: https://github.com/docker/build-push-action/issues/461
4647
- name: Setup Docker buildx
47-
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
48+
uses: docker/setup-buildx-action@v3
4849

4950
# Login against a Docker registry except on PR
5051
# https://github.com/docker/login-action
5152
- name: Log into registry ${{ env.REGISTRY }}
5253
if: github.event_name != 'pull_request'
53-
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
54+
uses: docker/login-action@v3
5455
with:
5556
registry: ${{ env.REGISTRY }}
5657
username: ${{ github.actor }}
@@ -63,10 +64,6 @@ jobs:
6364
uses: docker/metadata-action@v5
6465
with:
6566
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
66-
tags: |
67-
type=ref,event=branch
68-
type=semver,pattern={{version}}
69-
type=raw,value=latest,enable={{is_default_branch}}
7067

7168
# Build and push Docker image with Buildx (don't push on PR)
7269
# https://github.com/docker/build-push-action
@@ -75,8 +72,9 @@ jobs:
7572
uses: docker/build-push-action@v5
7673
with:
7774
context: .
78-
push: ${{ github.event_name != 'pull_request' }}
75+
push: true
7976
tags: ${{ steps.meta.outputs.tags }}
8077
labels: ${{ steps.meta.outputs.labels }}
78+
platforms: linux/amd64, linux/arm64
8179
cache-from: type=gha
8280
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)