Skip to content

Commit d691136

Browse files
committed
internal/ci: only run hugo with --buildDrafts when deploying CLs
We do so by conditionally setting BUILD_DRAFTS in the trybot repo, and then using this value when set in the call to dist. All of the CI stuff needs some love, but this fixes the broken state of CI in the short term. Also fix a bash bug in the passing of args from build.bash onto hugo. Signed-off-by: Paul Jolly <paul@myitcv.io> Change-Id: Ib420e73feb5984ca8e4d5d8406e49e4c3037dcca
1 parent a8c9b81 commit d691136

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

.github/workflows/trybot.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,12 @@ jobs:
204204
working-directory: playground
205205
- name: log into the central registry as porcuepine
206206
run: go run cuelang.org/go/cmd/cue login --token ${{ secrets.PORCUEPINE_CUE_TOKEN }}
207+
- if: |-
208+
github.repository == 'cue-lang/cuelang.org-trybot' && (contains(github.event.head_commit.message, '
209+
Dispatch-Trailer: {"type":"trybot"'))
210+
run: echo "BUILD_DRAFTS=--buildDrafts" >> $GITHUB_ENV
207211
- name: Dist
208-
run: ./_scripts/build.bash --baseURL https://cl-${{ fromJSON(steps.DispatchTrailer.outputs.value).CL }}-${{ fromJSON(steps.DispatchTrailer.outputs.value).patchset }}--cue-cls.netlify.app --buildDrafts
212+
run: ./_scripts/build.bash --baseURL https://cl-${{ fromJSON(steps.DispatchTrailer.outputs.value).CL }}-${{ fromJSON(steps.DispatchTrailer.outputs.value).patchset }}--cue-cls.netlify.app ${BUILD_DRAFTS:-}
209213
- name: Check that git is clean at the end of the job
210214
if: always()
211215
run: test -z "$(git status --porcelain)" || (git status; git diff; false)

_scripts/build.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,4 +178,4 @@ bash _scripts/runPreprocessor.bash execute $readonlycache $nocachevolume $skipca
178178
# Main site
179179
cd hugo
180180
$time npm ci
181-
$time hugo --cleanDestinationDir $minify $@
181+
$time hugo --cleanDestinationDir $minify "$@"

internal/ci/github/trybot.cue

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,15 @@ workflows: trybot: _repo.bashWorkflow & {
178178

179179
_porcuepineCueLogin,
180180

181+
// Set BUILD_DRAFTS=--buildDrafts if we are in the trybot repo for CL.
182+
// This env var, is used by the _dist step.
183+
{
184+
if: "github.repository == '\(_repo.trybotRepositoryPath)' && \(_repo.containsTrybotTrailer)"
185+
run: """
186+
echo "BUILD_DRAFTS=--buildDrafts" >> $GITHUB_ENV
187+
"""
188+
},
189+
181190
_dist & {
182191
_baseURL: _netlifyStep.#prime_url.CL
183192
},
@@ -349,7 +358,7 @@ _dist: githubactions.#Step & {
349358
// enforce https, and allow trailing slash to be added universally *if
350359
// needed* here, not by the _dist consumer.
351360
_baseURL: string & =~"^https://" & !~"/$"
352-
run: "./_scripts/build.bash --baseURL \(_baseURL) --buildDrafts"
361+
run: "./_scripts/build.bash --baseURL \(_baseURL) ${BUILD_DRAFTS:-}"
353362
}
354363

355364
_installNetlifyCLI: githubactions.#Step & {

0 commit comments

Comments
 (0)