Skip to content

Commit c65860d

Browse files
authored
Merge pull request #27 from coderdojo-japan/automate-jekyll-build
Jekyllビルド時のデータ更新を自動化
2 parents bff1711 + b648104 commit c65860d

File tree

3 files changed

+26
-15
lines changed

3 files changed

+26
-15
lines changed

.github/workflows/deploy_to_pages.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ jobs:
2626
2727
- name: 🔧 Build & Test
2828
run: |
29-
# Convert human-readable Geojson file into computer-friendly one
30-
bundle exec rake compact_geojson
29+
# Jekyll plugin automatically runs upsert_dojos_geojson, compact_geojson, and cache_dojo_logos
3130
JEKYLL_ENV=production bundle exec jekyll build
3231
JEKYLL_ENV=production bundle exec jekyll doctor
3332
SKIP_BUILD=true bundle exec rake test

.github/workflows/scheduler_daily.yml

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,16 @@ jobs:
5151
run: |
5252
bundle exec rake get_data_from_japan
5353
54-
- name: ☯️ Cache dojo logos in Japan
54+
- name: 🔧 Build data to render DojoMap
5555
run: |
56-
bundle exec rake cache_dojo_logos
56+
# Jekyll plugin automatically runs cache_dojo_logos, upsert_dojos_geojson, and compact_geojson
57+
JEKYLL_ENV=production bundle exec jekyll build
5758
58-
- name: 📍 Generate DojoMap from Earth/Japan data
59+
- name: ✅ Test
5960
run: |
60-
bundle exec rake upsert_dojos_geojson
61-
bundle exec rake compact_geojson
61+
# _site is already built in previous step
62+
JEKYLL_ENV=production bundle exec jekyll doctor
63+
SKIP_BUILD=true bundle exec rake test
6264
6365
- name: 🆙 Commit latest data to update DojoMap (if any)
6466
run: |
@@ -87,14 +89,6 @@ jobs:
8789
env:
8890
GITHUB_TOKEN:
8991

90-
- name: 🔧 Build & Test
91-
run: |
92-
# Convert human-readable Geojson file into computer-friendly one
93-
bundle exec rake compact_geojson
94-
JEKYLL_ENV=production bundle exec jekyll build
95-
JEKYLL_ENV=production bundle exec jekyll doctor
96-
SKIP_BUILD=true bundle exec rake test
97-
9892
# This is NOT for security reason but for others, especially who fork,
9993
# to easier find out which API key they need to replace with their own.
10094
# Check out the official tutorial for details: https://docs.geolonia.com/tutorial

_plugins/build_hooks.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Pre-build tasks that run before Jekyll builds the site
2+
Jekyll::Hooks.register :site, :after_init do |site|
3+
puts "🔄 Running pre-build tasks..."
4+
5+
# Update GeoJSON data
6+
puts " → Updating dojos.geojson..."
7+
system('bundle exec rake upsert_dojos_geojson')
8+
9+
# Compact GeoJSON for production
10+
puts " → Creating dojos.min.geojson..."
11+
system('bundle exec rake compact_geojson')
12+
13+
# Cache dojo logos
14+
puts " → Caching dojo logos..."
15+
system('bundle exec rake cache_dojo_logos')
16+
17+
puts "✅ Pre-build tasks completed"
18+
end

0 commit comments

Comments
 (0)