Skip to content

Commit 85c65df

Browse files
authored
Merge pull request #26 from alexandernicholson/main
feature(ci): improvements to ghcr image management
2 parents acb2d10 + cddfc2f commit 85c65df

1 file changed

Lines changed: 15 additions & 11 deletions

File tree

.github/workflows/publish-image.yml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ on:
66
- main
77
tags:
88
- 'v*'
9-
release:
10-
types: [published]
119
pull_request:
1210
workflow_dispatch:
1311

@@ -79,7 +77,7 @@ jobs:
7977
type=semver,pattern={{major}}.{{minor}},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
8078
type=semver,pattern={{major}},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
8179
flavor: |
82-
latest=auto
80+
latest=false
8381
suffix=-${{ matrix.arch }}
8482
labels: |
8583
org.opencontainers.image.source=${{ env.SOURCE_URL }}
@@ -99,16 +97,16 @@ jobs:
9997
labels: ${{ steps.meta.outputs.labels }}
10098
cache-from: type=gha,scope=${{ matrix.platform }}
10199
cache-to: type=gha,scope=${{ matrix.platform }},mode=max
102-
sbom: true
103-
provenance: true
100+
sbom: false
101+
provenance: false
104102

105103
- name: Attest image provenance (per-arch)
106104
if: github.event_name != 'pull_request'
107105
uses: actions/attest-build-provenance@v3.0.0
108106
with:
109107
subject-name: ${{ steps.vars.outputs.canonical }}
110108
subject-digest: ${{ steps.build.outputs.digest }}
111-
push-to-registry: true
109+
push-to-registry: false
112110

113111
manifest:
114112
name: Create multi-arch manifest and sign
@@ -151,8 +149,9 @@ jobs:
151149
type=semver,pattern={{version}},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
152150
type=semver,pattern={{major}}.{{minor}},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
153151
type=semver,pattern={{major}},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
152+
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }}
154153
flavor: |
155-
latest=auto
154+
latest=false
156155
labels: |
157156
org.opencontainers.image.source=${{ env.SOURCE_URL }}
158157
@@ -166,17 +165,22 @@ jobs:
166165
while IFS= read -r tag; do
167166
[ -z "$tag" ] && continue
168167
echo "Creating manifest for $tag"
168+
src_tag="$tag"
169+
if [[ "$tag" == *:latest && "${GITHUB_REF}" == refs/tags/* ]]; then
170+
ref="${GITHUB_REF#refs/tags/}"
171+
src_tag="${tag%:latest}:$ref"
172+
fi
169173
if [ -n "${IMAGE_DESCRIPTION:-}" ]; then
170174
docker buildx imagetools create \
171175
--tag "$tag" \
172176
--annotation "index:org.opencontainers.image.description=${IMAGE_DESCRIPTION}" \
173-
"${tag}-amd64" \
174-
"${tag}-arm64"
177+
"${src_tag}-amd64" \
178+
"${src_tag}-arm64"
175179
else
176180
docker buildx imagetools create \
177181
--tag "$tag" \
178-
"${tag}-amd64" \
179-
"${tag}-arm64"
182+
"${src_tag}-amd64" \
183+
"${src_tag}-arm64"
180184
fi
181185
done <<< "$tags"
182186

0 commit comments

Comments
 (0)