Skip to content

Commit b7b5acb

Browse files
committed
simplify workflows and makefile
1 parent 8bb585d commit b7b5acb

File tree

6 files changed

+40
-41
lines changed

6 files changed

+40
-41
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: 'Setup Build Environment'
2+
description: 'Set up Ruby, Node.js, and dependencies for Jekyll site building'
3+
4+
runs:
5+
using: 'composite'
6+
steps:
7+
- name: Install Ruby and Jekyll
8+
uses: ruby/setup-ruby@v1
9+
with:
10+
ruby-version: '3.2.2'
11+
bundler-cache: true
12+
cache-version: 0
13+
- name: Setup Node.JS 18
14+
uses: actions/setup-node@v4
15+
with:
16+
node-version: 18
17+
- name: Install mermaid-cli
18+
shell: bash
19+
run: npm install -g @mermaid-js/mermaid-cli
20+
- name: Install bundle dependencies
21+
shell: bash
22+
run: bundle

.github/workflows/build.yml

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,10 @@ jobs:
1717
- name: Configure Pages
1818
id: pages
1919
uses: actions/configure-pages@v5
20-
- name: Install Ruby and Jekyll
21-
uses: ruby/setup-ruby@v1
22-
with:
23-
ruby-version: '3.2.2'
24-
bundler-cache: true
25-
cache-version: 0
26-
- name: Setup Node.JS 18
27-
uses: actions/setup-node@v4
28-
with:
29-
node-version: 18
30-
- name: Install mermaid-cli
31-
run: npm install -g @mermaid-js/mermaid-cli
20+
- name: Setup Build Environment
21+
uses: ./.github/actions/setup-build
3222
- name: Generate Site
33-
run: |
34-
bundle
35-
make all
23+
run: make all
3624
env:
3725
JEKYLL_ENV: production
3826
ADD_JEKYLL_ARGS: --baseurl "${{ steps.pages.outputs.base_path }}"

.github/workflows/publish.yml

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,10 @@ jobs:
2525
- name: Configure Pages
2626
id: pages
2727
uses: actions/configure-pages@v5
28-
- name: Install Ruby and Jekyll
29-
uses: ruby/setup-ruby@v1
30-
with:
31-
ruby-version: '3.2.2'
32-
bundler-cache: true
33-
cache-version: 0
34-
- name: Setup Node.JS 18
35-
uses: actions/setup-node@v4
36-
with:
37-
node-version: 18
38-
- name: Install mermaid-cli
39-
run: npm install -g @mermaid-js/mermaid-cli
28+
- name: Setup Build Environment
29+
uses: ./.github/actions/setup-build
4030
- name: Generate Site
41-
run: |
42-
bundle
43-
make publish
31+
run: make publish
4432
env:
4533
JEKYLL_ENV: production
4634
ADD_JEKYLL_ARGS: --baseurl "${{ steps.pages.outputs.base_path }}"

Dockerfile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,17 @@ ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
1515
# Install correct bundler version
1616
RUN gem install bundler -v 2.7.1
1717

18+
# Install mermaid-cli globally
19+
RUN npm install -g @mermaid-js/mermaid-cli
20+
1821
WORKDIR /srv
1922

23+
# Copy dependency files first for better caching
24+
COPY Gemfile Gemfile.lock package*.json ./
25+
26+
# Install dependencies
27+
RUN bundle install && npm install
28+
2029
EXPOSE 4000
2130

22-
CMD ["bundle", "exec", "jekyll", "serve", "--host", "0.0.0.0", "--future", "--drafts", "--unpublished", "--incremental"]
31+
CMD ["sh", "-c", "bundle exec jekyll serve --host 0.0.0.0 --future --drafts --unpublished --incremental --force_polling"]

Makefile

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,6 @@ docker-clean:
2424
docker-compose down -v
2525
docker system prune -f
2626

27-
## Simple Docker commands
28-
docker-build:
29-
docker buildx build -t guide .
30-
31-
docker-run:
32-
@echo "Use 'make docker-dev' instead for better volume handling"
33-
@echo "Or run: docker-compose up dev"
3427

3528
clean:
3629
bundle exec jekyll clean

docker-compose.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ services:
1212
environment:
1313
- BUNDLE_PATH=/usr/local/bundle
1414
- JEKYLL_ENV=development
15-
- PATH=/srv/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
16-
command: sh -c "bundle install && npm install && bundle exec jekyll serve --host 0.0.0.0 --future --drafts --unpublished --incremental --force_polling"
15+
- PATH=/srv/node_modules/.bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin
1716

1817
shell:
1918
build: .
@@ -23,7 +22,7 @@ services:
2322
- node_modules_cache:/srv/node_modules
2423
environment:
2524
- BUNDLE_PATH=/usr/local/bundle
26-
- PATH=/srv/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
25+
- PATH=/srv/node_modules/.bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin
2726
entrypoint: /bin/sh
2827
profiles:
2928
- tools

0 commit comments

Comments
 (0)