Skip to content

Commit 501b199

Browse files
bugerclaude
andcommitted
perf: skip prod Docker steps on PRs, use larger runner for goreleaser
- Use vars.BUILD_RUNNER (falls back to vars.DEFAULT_RUNNER) so the goreleaser job can use a larger runner (e.g. warp-8x-x64) without affecting other jobs - Skip prod Docker metadata + build-push steps entirely on non-tag builds (saves ~9 min of unnecessary multi-platform builds, SBOM, provenance, and cache export that ran with push=false) - Remove redundant cache-to from prod steps (CI steps already export) - Simplify prod push: to true since step only runs on tags now Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 7c83bcb commit 501b199

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

.github/workflows/release.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
(needs.dep-guard.result == 'success' || needs.dep-guard.result == 'skipped') &&
4444
github.event.pull_request.draft == false
4545
name: '${{ matrix.golang_cross }}'
46-
runs-on: ${{ vars.DEFAULT_RUNNER }}
46+
runs-on: ${{ vars.BUILD_RUNNER || vars.DEFAULT_RUNNER }}
4747
permissions:
4848
id-token: write # AWS OIDC JWT
4949
contents: read # actions/checkout
@@ -176,6 +176,7 @@ jobs:
176176
BUILD_PACKAGE_NAME=tyk-gateway-ee
177177
- name: Docker metadata for ee tag push
178178
id: tag_metadata_ee
179+
if: startsWith(github.ref, 'refs/tags')
179180
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
180181
with:
181182
images: |
@@ -193,7 +194,7 @@ jobs:
193194
org.opencontainers.image.vendor=tyk.io
194195
org.opencontainers.image.version=${{ github.ref_name }}
195196
- name: push ee image to prod
196-
if: ${{ matrix.golang_cross == '1.25-bullseye' }}
197+
if: ${{ matrix.golang_cross == '1.25-bullseye' && startsWith(github.ref, 'refs/tags') }}
197198
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
198199
with:
199200
context: "dist"
@@ -202,8 +203,7 @@ jobs:
202203
provenance: mode=max
203204
sbom: true
204205
cache-from: type=gha
205-
cache-to: type=gha,mode=max
206-
push: ${{ startsWith(github.ref, 'refs/tags') }}
206+
push: true
207207
tags: ${{ steps.tag_metadata_ee.outputs.tags }}
208208
labels: ${{ steps.tag_metadata_ee.outputs.labels }}
209209
build-args: |
@@ -243,6 +243,7 @@ jobs:
243243
BASE_IMAGE=tykio/dhi-busybox:1.37-fips
244244
- name: Docker metadata for fips tag push
245245
id: tag_metadata_fips
246+
if: startsWith(github.ref, 'refs/tags')
246247
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
247248
with:
248249
images: |
@@ -259,7 +260,7 @@ jobs:
259260
org.opencontainers.image.vendor=tyk.io
260261
org.opencontainers.image.version=${{ github.ref_name }}
261262
- name: push fips image to prod
262-
if: ${{ matrix.golang_cross == '1.25-bullseye' }}
263+
if: ${{ matrix.golang_cross == '1.25-bullseye' && startsWith(github.ref, 'refs/tags') }}
263264
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
264265
with:
265266
context: "dist"
@@ -268,8 +269,7 @@ jobs:
268269
provenance: mode=max
269270
sbom: true
270271
cache-from: type=gha
271-
cache-to: type=gha,mode=max
272-
push: ${{ startsWith(github.ref, 'refs/tags') }}
272+
push: true
273273
tags: ${{ steps.tag_metadata_fips.outputs.tags }}
274274
labels: ${{ steps.tag_metadata_fips.outputs.labels }}
275275
build-args: |
@@ -321,6 +321,7 @@ jobs:
321321
BUILD_PACKAGE_NAME=tyk-gateway
322322
- name: Docker metadata for std tag push
323323
id: tag_metadata_std
324+
if: startsWith(github.ref, 'refs/tags')
324325
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
325326
with:
326327
images: |
@@ -338,7 +339,7 @@ jobs:
338339
org.opencontainers.image.vendor=tyk.io
339340
org.opencontainers.image.version=${{ github.ref_name }}
340341
- name: push std image to prod
341-
if: ${{ matrix.golang_cross == '1.25-bullseye' }}
342+
if: ${{ matrix.golang_cross == '1.25-bullseye' && startsWith(github.ref, 'refs/tags') }}
342343
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
343344
with:
344345
context: "dist"
@@ -347,8 +348,7 @@ jobs:
347348
provenance: mode=max
348349
sbom: true
349350
cache-from: type=gha
350-
cache-to: type=gha,mode=max
351-
push: ${{ startsWith(github.ref, 'refs/tags') }}
351+
push: true
352352
tags: ${{ steps.tag_metadata_std.outputs.tags }}
353353
labels: ${{ steps.tag_metadata_std.outputs.labels }}
354354
build-args: |

0 commit comments

Comments
 (0)