Skip to content

Commit bfc13a3

Browse files
ci: create a workflow to rebuild the jsonnet site
1 parent c7b6764 commit bfc13a3

1 file changed

Lines changed: 70 additions & 0 deletions

File tree

.github/workflows/doc_update.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Rebuild Docs
2+
3+
on:
4+
pull_request:
5+
types: [opened, reopened, synchronize, ready_for_review, review_requested]
6+
branches-ignore:
7+
- "gh-pages"
8+
push:
9+
branches:
10+
- "master"
11+
- "prepare-release"
12+
- "doc-workflow"
13+
tags:
14+
- v*
15+
workflow_dispatch:
16+
17+
permissions:
18+
contents: read
19+
20+
jobs:
21+
build_website:
22+
name: Build website
23+
runs-on: "ubuntu-24.04"
24+
steps:
25+
- uses: actions/checkout@v6
26+
- name: Create Gemfile
27+
run: |
28+
echo $'source "https://rubygems.org"\n\ngem "jekyll"\n' > Gemfile
29+
- name: Setup Ruby and Jekyll
30+
uses: ruby/setup-ruby@8d27f39a5e7ad39aebbcbd1324f7af020229645c # v1.287.0
31+
with:
32+
ruby-version: "4.0.1"
33+
bundler-cache: true
34+
- name: Build jsonnet binary
35+
if: steps.cache-jsonnet-binary.outputs.cache-hit != 'true'
36+
run: |
37+
make jsonnet
38+
- name: Set up output dir
39+
id: make-output-dir
40+
run: |
41+
WORKDIR="$(mktemp -d)"
42+
git fetch origin gh-pages
43+
git worktree add --no-checkout --detach "$WORKDIR"/work FETCH_HEAD
44+
echo "doc_output_dir=$WORKDIR" >> "$GITHUB_OUTPUT"
45+
- name: Build website
46+
env:
47+
WORKDIR: ${{ steps.make-output-dir.outputs.doc_output_dir }}
48+
run: |
49+
tools/scripts/update_web_content.sh
50+
bundler exec jekyll build -s doc -d "$WORKDIR"/work
51+
cd "$WORKDIR"/work
52+
# Keep existing libjsonnet.wasm.
53+
git checkout HEAD -- js/libjsonnet.wasm
54+
git add .
55+
- name: Diff docs
56+
env:
57+
WORKDIR: ${{ steps.make-output-dir.outputs.doc_output_dir }}
58+
run: |
59+
cd "$WORKDIR"/work
60+
git diff --cached --stat
61+
git diff --cached
62+
- name: Pack docs
63+
uses: actions/upload-artifact@v6
64+
with:
65+
name: gh-pages-content
66+
retention-days: 22
67+
include-hidden-files: true
68+
if-no-files-found: "error"
69+
path: ${{ steps.make-output-dir.outputs.doc_output_dir }}/work/
70+

0 commit comments

Comments
 (0)