Skip to content

Commit 3ffd092

Browse files
authored
jekyll: update how files are generated (#1170)
Signed-off-by: Nick Santos <[email protected]>
1 parent fd025bb commit 3ffd092

File tree

8 files changed

+66
-27
lines changed

8 files changed

+66
-27
lines changed

.github/workflows/deploy.yaml

+9-18
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,6 @@ jobs:
1818
- name: Checkout
1919
uses: actions/checkout@v4
2020

21-
- name: Setup Ruby
22-
uses: ruby/setup-ruby@v1
23-
with:
24-
ruby-version: 3.2.0
25-
bundler-cache: true
26-
- name: Install dependencies
27-
run: |
28-
bundle install
29-
3021
- name: Check for changes
3122
id: paths
3223
uses: dorny/paths-filter@v2
@@ -53,14 +44,14 @@ jobs:
5344
role-to-assume: arn:aws:iam::710015040892:role/prod-collaboration-blog.tilt.dev-20250228142654978300000003
5445
aws-region: us-east-1
5546

56-
- name: Create website blog.tilt.dev
47+
- name: Build blog static site
5748
if: steps.paths.outputs.blog == 'true'
5849
run: |
59-
JEKYLL_ENV=production bundle exec jekyll build -s blog -d blog/_site
50+
make build-blog
6051
- name: Deploy website blog.tilt.dev
6152
if: steps.paths.outputs.blog == 'true'
6253
run: |
63-
aws s3 sync blog/_site s3://prod-collaboration-blog.tilt.dev/ --region us-east-1 --delete
54+
aws s3 sync build/blog s3://prod-collaboration-blog.tilt.dev/ --region us-east-1 --delete
6455
- name: Invalidate CloudFront cache for blog.tilt.dev
6556
if: steps.paths.outputs.blog == 'true'
6657
run: |
@@ -73,14 +64,14 @@ jobs:
7364
with:
7465
role-to-assume: arn:aws:iam::710015040892:role/prod-collaboration-docs.tilt.dev-20250228142654979400000004
7566
aws-region: us-east-1
76-
- name: Create website docs.tilt.dev
67+
- name: Build docs static site
7768
if: steps.paths.outputs.docs == 'true'
7869
run: |
79-
JEKYLL_ENV=production bundle exec jekyll build -s docs -d docs/_site
70+
make build-docs
8071
- name: Deploy website docs.tilt.dev
8172
if: steps.paths.outputs.docs == 'true'
8273
run: |
83-
aws s3 sync docs/_site s3://prod-collaboration-docs.tilt.dev/ --region us-east-1 --delete
74+
aws s3 sync build/docs s3://prod-collaboration-docs.tilt.dev/ --region us-east-1 --delete
8475
- name: Invalidate CloudFront cache for docs.tilt.dev
8576
if: steps.paths.outputs.docs == 'true'
8677
run: |
@@ -93,14 +84,14 @@ jobs:
9384
with:
9485
role-to-assume: arn:aws:iam::710015040892:role/prod-collaboration-tilt.dev-20250228142654974200000002
9586
aws-region: us-east-1
96-
- name: Create website www.tilt.dev
87+
- name: Build site static site
9788
if: steps.paths.outputs.site == 'true'
9889
run: |
99-
JEKYLL_ENV=production bundle exec jekyll build -s src -d src/_site
90+
make build-site
10091
- name: Deploy website www.tilt.dev
10192
if: steps.paths.outputs.site == 'true'
10293
run: |
103-
aws s3 sync src/_site s3://prod-collaboration-tilt.dev/ --region us-east-1 --delete
94+
aws s3 sync build/site s3://prod-collaboration-tilt.dev/ --region us-east-1 --delete
10495
- name: Invalidate CloudFront cache for www.tilt.dev
10596
if: steps.paths.outputs.site == 'true'
10697
run: |

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,7 @@ build-iPhoneSimulator/
5555
tilt_modules
5656

5757
.DS_Store
58+
.aider*
59+
60+
# Ignore _site subdirectories
61+
build

Makefile

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: api stars cli-toc
1+
.PHONY: api stars cli-toc build-blog build-docs build-site
22

33
api:
44
docker rm tilt.api || exit 0
@@ -18,3 +18,18 @@ stars:
1818

1919
cli-toc:
2020
./hack/inject_cli_toc.sh
21+
22+
build-blog:
23+
rm -fR build/blog
24+
docker build -t tilt-site-base -f deploy/base.dockerfile .
25+
docker buildx build --target static --output type=local,dest=build/blog -f deploy/blog.dockerfile .
26+
27+
build-docs:
28+
rm -fR build/docs
29+
docker build -t tilt-site-base -f deploy/base.dockerfile .
30+
docker buildx build --target static --output type=local,dest=build/docs -f deploy/docs.dockerfile .
31+
32+
build-site:
33+
rm -fR build/site
34+
docker build -t tilt-site-base -f deploy/base.dockerfile .
35+
docker buildx build --target static --output type=local,dest=build/site -f deploy/site.dockerfile .

deploy/base.dockerfile

+2
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@ WORKDIR /src
1414
ADD ./src/Gemfile /src/
1515
ADD ./src/Gemfile.lock /src/
1616
RUN bundle install
17+
18+
ENTRYPOINT ["jekyll"]

deploy/blog.dockerfile

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
1-
FROM tilt-site-base
1+
FROM tilt-site-base AS sources
22

33
WORKDIR /blog
44

55
RUN mkdir -p /blog
66
ADD src /src/
77
ADD blog /blog/
88
ADD healthcheck.sh .
9-
ENTRYPOINT bundle exec jekyll serve --trace --future --config _config.yml,_config-dev.yml
9+
10+
FROM sources AS static-builder
11+
RUN JEKYLL_ENV=production bundle exec jekyll build -d _site
12+
13+
FROM scratch AS static
14+
COPY --from=static-builder /blog/_site /
15+
16+
FROM sources
17+
ENTRYPOINT ["bundle", "exec", "jekyll", "serve", "--trace", "--future", "--config", "_config.yml,_config-dev.yml"]

deploy/docs.dockerfile

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
1-
FROM tilt-site-base
1+
FROM tilt-site-base AS sources
22

33
WORKDIR /docs
44

55
RUN mkdir -p /docs
66
ADD src /src/
77
ADD docs /docs/
88
ADD healthcheck.sh .
9-
ENTRYPOINT bundle exec jekyll serve --trace --config _config.yml,_config-dev.yml
9+
10+
FROM sources AS static-builder
11+
RUN JEKYLL_ENV=production bundle exec jekyll build -d _site
12+
13+
FROM scratch AS static
14+
COPY --from=static-builder /docs/_site /
15+
16+
FROM sources
17+
ENTRYPOINT ["bundle", "exec", "jekyll", "serve", "--trace", "--config", "_config.yml,_config-dev.yml"]

deploy/site.dockerfile

+15-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
1-
FROM tilt-site-base
2-
ADD ./src .
1+
FROM tilt-site-base AS sources
2+
3+
WORKDIR /src
4+
5+
RUN mkdir -p /src
6+
ADD src /src/
37
ADD healthcheck.sh .
4-
ENTRYPOINT bundle exec jekyll serve --trace --config _config.yml,_config-dev.yml
8+
9+
FROM sources AS static-builder
10+
RUN JEKYLL_ENV=production bundle exec jekyll build -d _site
11+
12+
FROM scratch AS static
13+
COPY --from=static-builder /src/_site /
14+
15+
FROM sources
16+
ENTRYPOINT ["bundle", "exec", "jekyll", "serve", "--trace", "--config", "_config.yml,_config-dev.yml"]

src/.#_config.ym

-1
This file was deleted.

0 commit comments

Comments
 (0)