Skip to content

Commit

Permalink
internal/ci: deploy tip.cuelang.org
Browse files Browse the repository at this point in the history
This adds a job at the end of CI (only in the main repo, on the default
branch or its test delegate) that deploys tip.cuelang.org built against
the tip of cue-lang/cue.

It does this by relying on the jobs that ran beforehand to have patched
the site to work cue-lang/cue and then to have rebuilt the site
successfully.

Signed-off-by: Jonathan Matthews <[email protected]>
Change-Id: Ic97f59fd423eaa080684f0e45d314e8fb148e49e
Dispatch-Trailer: {"type":"trybot","CL":1201039,"patchset":1,"ref":"refs/changes/39/1201039/1","targetBranch":"master"}
  • Loading branch information
jpluscplusm authored and cueckoo committed Sep 11, 2024
1 parent 58ef8a5 commit f02a3d0
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/trybot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -241,3 +241,6 @@ jobs:
- if: github.repository == 'cue-lang/cuelang.org' && (github.ref == 'refs/heads/master' || (github.ref == 'refs/heads/ci/test'))
name: 'tip.cuelang.org: Check if the site builds against the tip of cue-lang/cue'
run: _scripts/regenPostInfraChange.bash
- if: github.repository == 'cue-lang/cuelang.org' && (github.ref == 'refs/heads/master' || (github.ref == 'refs/heads/ci/test'))
name: 'tip.cuelang.org: Deploy the site'
run: _scripts/tipDeploy.bash
22 changes: 22 additions & 0 deletions _scripts/tipDeploy.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash
set -euo pipefail

# Usage:
# tipDeploy.bash
#
# tipDeploy commits the current state of the working tree and force-pushes it
# to the "tip" branch, which triggers a build-and-deploy of tip.cuelang.org
# inside Netlify.

# cd to the parent directory to that containing the script
cd "$( dirname "${BASH_SOURCE[0]}" )"
cd ..

headShortRef=$(git rev-parse --short HEAD)

git add content/**/gen_cache.cue
git commit --allow-empty --message "tip.cuelang.org: $headShortRef: cache files"
git add .
git commit --allow-empty --message "tip.cuelang.org: $headShortRef: source files"

git push origin HEAD:tip
6 changes: 6 additions & 0 deletions internal/ci/github/trybot.cue
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,12 @@ workflows: trybot: _repo.bashWorkflow & {
if: "github.repository == '\(_repo.githubRepositoryPath)' && (github.ref == 'refs/heads/\(_repo.defaultBranch)' || \(_repo.isTestDefaultBranch))"
run: "_scripts/regenPostInfraChange.bash"
},
json.#step & {
name: "tip.cuelang.org: Deploy the site"
// Only run in the main repo on the default branch or its designated test branch.
if: "github.repository == '\(_repo.githubRepositoryPath)' && (github.ref == 'refs/heads/\(_repo.defaultBranch)' || \(_repo.isTestDefaultBranch))"
run: "_scripts/tipDeploy.bash"
},
]
}

Expand Down

0 comments on commit f02a3d0

Please sign in to comment.