1111 required : true
1212 default : true
1313 type : boolean
14+ dogorelease :
15+ description : " Run goreleaser"
16+ required : true
17+ default : true
18+ type : boolean
19+ dodistrelease :
20+ description : " Release distribution source tarball"
21+ required : true
22+ default : true
23+ type : boolean
1424
1525permissions :
1626 contents : write
@@ -36,13 +46,15 @@ jobs:
3646 exit 1
3747 fi
3848
39- build-ui :
49+ build-ui-dist :
4050 runs-on : ubuntu-latest
4151 needs :
4252 - setup
53+ outputs :
54+ version : ${{ steps.make-distribution-tarball.outputs.version }}
4355 steps :
4456 - name : Checkout
45- uses : actions/checkout@v4.1.7
57+ uses : actions/checkout@v4
4658 with :
4759 fetch-depth : 0 # Required by GoRelease
4860
@@ -96,11 +108,37 @@ jobs:
96108 run : |
97109 make static-dist
98110
99- release :
111+ - name : Make LICENSE_DEPENDENCIES.md
112+ if : inputs.dodistrelease
113+ run : |
114+ go run github.com/google/go-licenses@v1.6.0 report ./... --ignore github.com/openbao/openbao --template LICENSE_DEPENDENCIES.tpl > LICENSE_DEPENDENCIES.md
115+
116+ - name : go mod vendor
117+ if : inputs.dodistrelease
118+ run : |
119+ go mod vendor
120+
121+ - name : Make distribution source tarball
122+ if : inputs.dodistrelease
123+ id : make-distribution-tarball
124+ run : |
125+ version="$(git describe --tags --exclude "api/*" --exclude "sdk/*" --abbrev=0 | sed 's/^v//')"
126+ echo "version=$version" | tee -a "$GITHUB_OUTPUT"
127+ tar --exclude .git --exclude '*.gz' --exclude '*/ui/.yarn/cache' --exclude node_modules -cJf ../openbao-dist-$version.tar.xz --xform="s,^\.,openbao-dist-$version," .
128+ mv ../*.xz .
129+
130+ - name : Upload distribution source tarball artifact
131+ if : inputs.dodistrelease
132+ uses : actions/upload-artifact@v4
133+ with :
134+ name : dist-tarball
135+ path : ' *.xz'
136+ retention-days : 1
137+
138+ release-main :
100139 runs-on : ubuntu-latest
101140 needs :
102- - setup
103- - build-ui
141+ - build-ui-dist
104142 env :
105143 DOCKER_CLI_EXPERIMENTAL : " enabled"
106144 strategy :
@@ -115,16 +153,18 @@ jobs:
115153 - windows
116154 steps :
117155 - name : " Check free space on runner"
156+ if : inputs.dogorelease
118157 run : |
119158 df -h .
120159
121160 - name : Checkout
122- uses : actions/checkout@v4.1.7
161+ if : inputs.dogorelease
162+ uses : actions/checkout@v4
123163 with :
124164 fetch-depth : 0 # Required by GoRelease
125165
126166 - name : Configure nightly build
127- if : inputs.nightly
167+ if : inputs.dogorelease && inputs. nightly
128168 run : |
129169 # Locally remove previous nightly tags so they do not interfere
130170 # with nightly tag computation. Also add the upstream.
@@ -144,12 +184,15 @@ jobs:
144184 git tag "$nightly_tag"
145185
146186 - name : Golang Setup
187+ if : inputs.dogorelease
147188 uses : ./.github/actions/set-up-go
148189
149190 - name : go-check
191+ if : inputs.dogorelease
150192 run : go version
151193
152194 - name : UI Cache Setup
195+ if : inputs.dogorelease
153196 uses : actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
154197 with :
155198 path : |
@@ -158,41 +201,46 @@ jobs:
158201
159202 # Supports syft/sbom generation
160203 - uses : anchore/sbom-action/download-syft@v0
204+ if : inputs.dogorelease
161205
162206 # Supports Buildx
163207 - name : Qemu Setup
208+ if : inputs.dogorelease
164209 uses : docker/setup-qemu-action@v3
165210
166211 - name : Buildx Setup
212+ if : inputs.dogorelease
167213 uses : docker/setup-buildx-action@v3
168214
169215 - name : Cosign Install
216+ if : inputs.dogorelease
170217 uses : sigstore/cosign-installer@v3
171218
172219 - name : GPG Import
220+ if : inputs.dogorelease
173221 id : gpg-import
174222 uses : crazy-max/ghaction-import-gpg@v6
175223 with :
176224 gpg_private_key : ${{ secrets.GPG_PRIVATE_KEY }}
177225 passphrase : ${{ secrets.GPG_PASSWORD }}
178226
179227 - name : " Docker Login: ghcr.io"
180- if : startsWith(github.ref, 'refs/tags/') || inputs.nightly
228+ if : inputs.dogorelease && ( startsWith(github.ref, 'refs/tags/') || inputs.nightly)
181229 uses : docker/login-action@v3
182230 with :
183231 registry : ghcr.io
184232 username : ${{ github.actor }}
185233 password : ${{ secrets.GITHUB_TOKEN }}
186234
187235 - name : " Docker Login: docker.io"
188- if : startsWith(github.ref, 'refs/tags/') || inputs.nightly
236+ if : inputs.dogorelease && ( startsWith(github.ref, 'refs/tags/') || inputs.nightly)
189237 uses : docker/login-action@v3
190238 with :
191239 username : ${{ secrets.DOCKER_USERNAME }}
192240 password : ${{ secrets.DOCKER_TOKEN }}
193241
194242 - name : " Docker Login: quay.io"
195- if : startsWith(github.ref, 'refs/tags/') || inputs.nightly
243+ if : inputs.dogorelease && ( startsWith(github.ref, 'refs/tags/') || inputs.nightly)
196244 uses : docker/login-action@v3
197245 with :
198246 registry : quay.io
@@ -201,7 +249,7 @@ jobs:
201249
202250 # Needed for nPFM
203251 - name : Create GPG Signing Key File
204- if : startsWith(github.ref, 'refs/tags/') || inputs.nightly
252+ if : inputs.dogorelease && ( startsWith(github.ref, 'refs/tags/') || inputs.nightly)
205253 run : |
206254 GPG_KEY_FILE=/tmp/signing-key.gpg
207255 echo "${{ secrets.GPG_PRIVATE_KEY_BASE64 }}" | base64 -di > "${GPG_KEY_FILE}"
@@ -210,19 +258,19 @@ jobs:
210258 GPG_TTY : /dev/ttys000 # Set the GPG_TTY to avoid issues with pinentry
211259
212260 - name : Install GoReleaser
213- if : startsWith(github.ref, 'refs/tags/') || inputs.nightly
261+ if : inputs.dogorelease && ( startsWith(github.ref, 'refs/tags/') || inputs.nightly)
214262 uses : goreleaser/goreleaser-action@v6
215263 with :
216264 install-only : true
217265 # TODO: remove version pinning when Goreleaser 2.8 is released
218266 version : v2.5.1
219267
220268 - name : Install C compiler for arm64 CGO cross-compilation
221- if : matrix.release_os == 'hsm'
269+ if : inputs.dogorelease && matrix.release_os == 'hsm'
222270 run : sudo apt install -y gcc-aarch64-linux-gnu
223271
224272 - name : " GoReleaser: Release"
225- if : startsWith(github.ref, 'refs/tags/') || inputs.nightly
273+ if : inputs.dogorelease && ( startsWith(github.ref, 'refs/tags/') || inputs.nightly)
226274 run : |
227275 if [[ ! -f "goreleaser.${{ matrix.release_os }}.yaml" ]]; then
228276 yq e '.builds[0].goos |= ["${{ matrix.release_os }}"] | .checksum.name_template |= "checksums-${{ matrix.release_os }}.txt"' "goreleaser.other.yaml" | goreleaser release --clean --timeout=60m --verbose --parallelism 2 -f -
@@ -245,3 +293,33 @@ jobs:
245293 if [ -n "${GPG_KEY_FILE}" ]; then
246294 rm -rf "${GPG_KEY_FILE}"
247295 fi
296+
297+ release-dist :
298+ runs-on : ubuntu-latest
299+ if : inputs.dodistrelease
300+ needs :
301+ - build-ui-dist
302+ - release-main
303+ env :
304+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
305+ TAGNAME : v${{ needs.build-ui-dist.outputs.version }}
306+ steps :
307+ - name : Checkout
308+ if : ${{ !inputs.dogorelease }}
309+ uses : actions/checkout@v4
310+ with :
311+ fetch-tags : true
312+
313+ - name : Create release if necessary
314+ if : ${{ !inputs.dogorelease }}
315+ run : |
316+ gh release create -t $TAGNAME --verify-tag $TAGNAME || true
317+
318+ - name : Download dist-tarball artifact
319+ uses : actions/download-artifact@v4
320+ with :
321+ name : dist-tarball
322+
323+ - name : Release distribution source tarball
324+ run : |
325+ gh release upload $TAGNAME *.xz
0 commit comments