Skip to content

Commit 0891ef6

Browse files
committed
refactor release pipeline: TAG_TOKEN, skip-checks, bump go-make
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
1 parent 52585ff commit 0891ef6

3 files changed

Lines changed: 28 additions & 12 deletions

File tree

.github/workflows/release.yaml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ on:
1313
version:
1414
description: tag the latest commit on main with the given version (prefixed with v)
1515
required: true
16+
skip-checks:
17+
description: skip the check-gate (release even if checks have not passed)
18+
required: false
19+
type: boolean
20+
default: false
1621

1722
jobs:
1823
version-available:
@@ -23,7 +28,9 @@ jobs:
2328
version: ${{ github.event.inputs.version }}
2429

2530
check-gate:
31+
if: ${{ !inputs.skip-checks }}
2632
permissions:
33+
contents: read # required for the reusable workflow to check out the repo
2734
checks: read # required for getting the status of specific check names
2835
uses: anchore/workflows/.github/workflows/check-gate.yaml@8b2b1caf40e03933c6807e03b99e883e2ceb5ac8 # v0.4.0
2936
with:
@@ -33,10 +40,18 @@ jobs:
3340

3441
release:
3542
needs: [check-gate, version-available]
36-
environment: release # gates release on required reviewers; provides DEPLOY_KEY secret
43+
# run even when check-gate is skipped, but never when version-available
44+
# failed/was skipped, nor when check-gate failed or was cancelled. note:
45+
# always() disables the implicit success() gate on ALL needs, so the
46+
# version-available requirement must be re-asserted explicitly here.
47+
if: >-
48+
${{ always()
49+
&& needs.version-available.result == 'success'
50+
&& !contains(fromJSON('["failure", "cancelled"]'), needs.check-gate.result) }}
51+
environment: release # gates release on required reviewers
3752
runs-on: ubuntu-24.04
3853
permissions:
39-
contents: read # tag pushes go via deploy key, not GITHUB_TOKEN
54+
contents: read # tag pushes go via TAG_TOKEN, not GITHUB_TOKEN
4055
steps:
4156
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
4257
with:
@@ -55,6 +70,7 @@ jobs:
5570
- name: Create release
5671
env:
5772
GITHUB_TOKEN: ${{ github.token }}
58-
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
73+
# for pushing tags (does not inherit workflow permissions)
74+
TAG_TOKEN: ${{ secrets.TAG_TOKEN }}
5975
RELEASE_VERSION: ${{ github.event.inputs.version }}
6076
run: make ci-release

.make/go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ module github.com/anchore/sbom-action/.make
22

33
go 1.25.0
44

5-
require github.com/anchore/go-make v0.4.0
5+
require github.com/anchore/go-make v0.7.0
66

77
require (
88
github.com/bmatcuk/doublestar/v4 v4.10.0 // indirect
99
github.com/goccy/go-yaml v1.19.2 // indirect
10-
golang.org/x/mod v0.35.0 // indirect
11-
golang.org/x/sys v0.44.0 // indirect
10+
golang.org/x/mod v0.37.0 // indirect
11+
golang.org/x/sys v0.46.0 // indirect
1212
)

.make/go.sum

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
github.com/anchore/go-make v0.4.0 h1:poFE4PXcHwvix2E8AhdM7YHZ15bMhZb+W02i3+qrP8M=
2-
github.com/anchore/go-make v0.4.0/go.mod h1:Nc/tkwQHW1d1Vi8+0rtS/vSrH6pxieaUQXLdrctn+8g=
1+
github.com/anchore/go-make v0.7.0 h1:qosSwNWV/SsLFc1pI0DlrCZ2BUSDcGDcSKM6HdlnT6c=
2+
github.com/anchore/go-make v0.7.0/go.mod h1:4M6TnArb5w693VyWsgr5dCWrk2BLNu/ed4JUcsrzS34=
33
github.com/bmatcuk/doublestar/v4 v4.10.0 h1:zU9WiOla1YA122oLM6i4EXvGW62DvKZVxIe6TYWexEs=
44
github.com/bmatcuk/doublestar/v4 v4.10.0/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc=
55
github.com/goccy/go-yaml v1.19.2 h1:PmFC1S6h8ljIz6gMRBopkjP1TVT7xuwrButHID66PoM=
66
github.com/goccy/go-yaml v1.19.2/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
7-
golang.org/x/mod v0.35.0 h1:Ww1D637e6Pg+Zb2KrWfHQUnH2dQRLBQyAtpr/haaJeM=
8-
golang.org/x/mod v0.35.0/go.mod h1:+GwiRhIInF8wPm+4AoT6L0FA1QWAad3OMdTRx4tFYlU=
9-
golang.org/x/sys v0.44.0 h1:ildZl3J4uzeKP07r2F++Op7E9B29JRUy+a27EibtBTQ=
10-
golang.org/x/sys v0.44.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
7+
golang.org/x/mod v0.37.0 h1:vF1DjpVEshcIqoEaauuHebaLk1O1forxjxBaVn884JQ=
8+
golang.org/x/mod v0.37.0/go.mod h1:m8S8VeM9r4dzDwjrKO0a1sZP3YjeMamRRlD+fmR2Q/0=
9+
golang.org/x/sys v0.46.0 h1:noSf2Fq6F8DBgS+LysIkx7rIExoNHJsxOAtPp4rthXw=
10+
golang.org/x/sys v0.46.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=

0 commit comments

Comments
 (0)