1212permissions :
1313 contents : read
1414
15+ # Never release the same tag twice at once: a dispatch while the tag push is
16+ # still in flight would race for the same release and artifacts.
17+ concurrency :
18+ group : release-${{ inputs.tag || github.ref_name }}
19+
1520jobs :
1621 goreleaser :
1722 runs-on : ubuntu-latest
@@ -29,16 +34,13 @@ jobs:
2934 - uses : actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
3035 with :
3136 go-version-file : go.mod
32- - if : github.event_name == 'push'
33- uses : docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
34- - if : github.event_name == 'push'
35- uses : docker/login-action@371161bbe7024a29a25c5e19bfcbc0804fe9ad2c # v4.5.2
37+ - uses : docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
38+ - uses : docker/login-action@371161bbe7024a29a25c5e19bfcbc0804fe9ad2c # v4.5.2
3639 with :
3740 registry : ghcr.io
3841 username : ${{ github.actor }}
3942 password : ${{ secrets.GITHUB_TOKEN }}
4043 - name : Generate GitHub App token
41- if : github.event_name == 'push'
4244 id : app-token
4345 uses : actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
4446 with :
@@ -52,24 +54,23 @@ jobs:
5254 - uses : goreleaser/goreleaser-action@f06c13b6b1a9625abc9e6e439d9c05a8f2190e94 # v7.2.3
5355 with :
5456 version : " ~> v2"
55- args : ${{ github.event_name == 'workflow_dispatch' && 'build --clean' || ' release --clean' }}
57+ args : release --clean
5658 env :
5759 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
5860 HOMEBREW_TAP_GITHUB_TOKEN : ${{ steps.app-token.outputs.token }}
5961 # Attests every file listed in the checksum file.
60- - if : github.event_name == 'push'
61- uses : actions/attest@508db95dd578ae2727ebd6217d5ba78e4fbda05d # v4.2.1
62+ - uses : actions/attest@508db95dd578ae2727ebd6217d5ba78e4fbda05d # v4.2.1
6263 with :
6364 subject-checksums : ./dist/checksums.txt
64- - if : github.event_name == 'push'
65- uses : actions/attest@508db95dd578ae2727ebd6217d5ba78e4fbda05d # v4.2.1
65+ - uses : actions/attest@508db95dd578ae2727ebd6217d5ba78e4fbda05d # v4.2.1
6666 with :
6767 subject-checksums : ./dist/digests.txt
6868
6969 - uses : actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
7070 with :
7171 node-version : 24 # npm >= 11.5.1 required for OIDC trusted publishing
7272 - name : Publish npm packages
73+ continue-on-error : ${{ github.event_name == 'workflow_dispatch' }}
7374 uses : evg4b/goreleaser-npm-publisher-action@16087d5aafd974ba267f861cc3723f52ea14d6e4 # v1.6.0
7475 with :
7576 name : cli
8990 install-script :
9091 name : install.sh (${{ matrix.os }})
9192 needs : goreleaser
92- if : github.event_name == 'push'
9393 strategy :
9494 fail-fast : false
9595 matrix :
@@ -98,20 +98,25 @@ jobs:
9898 steps :
9999 - uses : actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
100100 with :
101+ ref : ${{ inputs.tag && format('refs/tags/{0}', inputs.tag) || '' }}
101102 persist-credentials : false
102- - run : sh install.sh --version "$GITHUB_REF_NAME" --bin-dir "$RUNNER_TEMP/bin"
103+ - run : sh install.sh --version "$TAG" --bin-dir "$RUNNER_TEMP/bin"
104+ env :
105+ TAG : ${{ inputs.tag || github.ref_name }}
103106 - run : flagsmith --version
104107
105108 install-script-windows :
106109 name : install.ps1
107110 needs : goreleaser
108- if : github.event_name == 'push'
109111 runs-on : windows-latest
110112 steps :
111113 - uses : actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
112114 with :
115+ ref : ${{ inputs.tag && format('refs/tags/{0}', inputs.tag) || '' }}
113116 persist-credentials : false
114- - run : ./install.ps1 -Version $env:GITHUB_REF_NAME
117+ - run : ./install.ps1 -Version $env:TAG
115118 shell : pwsh
119+ env :
120+ TAG : ${{ inputs.tag || github.ref_name }}
116121 - run : flagsmith --version
117122 shell : pwsh
0 commit comments