Skip to content

Commit 422dce4

Browse files
authored
Merge pull request #138 from sp-yduck/improve/ci
use make docker-buildx instead of build-and-push action
2 parents cd7f6ee + f296bcb commit 422dce4

File tree

1 file changed

+3
-54
lines changed

1 file changed

+3
-54
lines changed
Lines changed: 3 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,26 @@
11
name: publish container image
22

3-
# This workflow uses actions that are not certified by GitHub.
4-
# They are provided by a third-party and are governed by
5-
# separate terms of service, privacy policy, and support
6-
# documentation.
7-
83
on:
94
push:
105
# Publish semver tags as releases.
116
tags: [ 'v*.*.*' ]
127

138
env:
14-
# Use docker.io for Docker Hub if empty
159
REGISTRY: ghcr.io
1610
# github.repository as <account>/<repo>
1711
IMAGE_NAME: ${{ github.repository }}
1812

1913

2014
jobs:
2115
build:
22-
2316
runs-on: ubuntu-latest
2417
permissions:
2518
contents: read
2619
packages: write
27-
# This is used to complete the identity challenge
28-
# with sigstore/fulcio when running outside of PRs.
29-
id-token: write
3020

3121
steps:
3222
- name: Checkout repository
33-
uses: actions/checkout@v3
34-
35-
# Install the cosign tool except on PR
36-
# https://github.com/sigstore/cosign-installer
37-
- name: Install cosign
38-
if: github.event_name != 'pull_request'
39-
uses: sigstore/cosign-installer@6e04d228eb30da1757ee4e1dd75a0ec73a653e06 #v3.1.1
40-
with:
41-
cosign-release: 'v2.1.1'
42-
43-
# Setup QEMU for multi-arch builds
44-
- name: Setup QEMU
45-
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
46-
47-
# Workaround: https://github.com/docker/build-push-action/issues/461
48-
- name: Setup Docker buildx
49-
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
23+
uses: actions/checkout@v4
5024

5125
# Login against a Docker registry except on PR
5226
# https://github.com/docker/login-action
@@ -66,31 +40,6 @@ jobs:
6640
with:
6741
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
6842

69-
# Build and push Docker image with Buildx (don't push on PR)
70-
# https://github.com/docker/build-push-action
43+
# platform = linux/amd64,linux/arm64,linux/s390x,linux/ppc64le
7144
- name: Build and push Docker image
72-
id: build-and-push
73-
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
74-
with:
75-
context: .
76-
platforms: linux/amd64,linux/arm,linux/arm64
77-
push: ${{ github.event_name != 'pull_request' }}
78-
tags: ${{ steps.meta.outputs.tags }}
79-
labels: ${{ steps.meta.outputs.labels }}
80-
cache-from: type=gha
81-
cache-to: type=gha,mode=max
82-
83-
# Sign the resulting Docker image digest except on PRs.
84-
# This will only write to the public Rekor transparency log when the Docker
85-
# repository is public to avoid leaking data. If you would like to publish
86-
# transparency data even for private images, pass --force to cosign below.
87-
# https://github.com/sigstore/cosign
88-
- name: Sign the published Docker image
89-
if: ${{ github.event_name != 'pull_request' }}
90-
env:
91-
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
92-
TAGS: ${{ steps.meta.outputs.tags }}
93-
DIGEST: ${{ steps.build-and-push.outputs.digest }}
94-
# This step uses the identity token to provision an ephemeral certificate
95-
# against the sigstore community Fulcio instance.
96-
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
45+
run: "make docker-buildx PLATFORMS=linux/amd64,linux/arm64,linux/s390x,linux/ppc64le IMG=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.tags }}"

0 commit comments

Comments
 (0)