Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to Hugo #818

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
11 changes: 1 addition & 10 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,7 @@ root = true
[*]
charset = utf-8
end_of_line = lf
indent_style = tab
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

# YAML requires indentation with spaces instead of tabs.
[*.{yml,yaml}]
indent_style = space
indent_size = 2

# Ruby scripts and plugins for Jekyll
[*.rb]
indent_style = space
indent_size = 2
50 changes: 31 additions & 19 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,39 @@ concurrency:
group: pr-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-ci
cancel-in-progress: true

# Default to bash
defaults:
run:
shell: bash

jobs:
build:
name: Build sources from the PR branch
runs-on: ubuntu-latest

env:
HUGO_VERSION: 0.123.0
steps:
- uses: actions/checkout@v3

# Configure the build environment.

- name: Install Ruby 3.1
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1'
# Runs 'bundle install' and caches installed gems automatically
bundler-cache: true

- name: Install Minify
run: sudo apt-get update && sudo apt-get install minify

# Build the website.

- name: Build the static website
run: bundle exec jekyll build
- name: Install Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb

- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0

- name: Setup Pages
id: pages
uses: actions/configure-pages@v4

- name: Install Node.js dependencies
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"

- name: Build with Hugo
env:
# For maximum backward compatibility with Hugo modules
HUGO_ENVIRONMENT: production
HUGO_ENV: production
run: make build
86 changes: 53 additions & 33 deletions .github/workflows/build-website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,47 +5,67 @@ on:
push:
branches: [ master ]

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Make sure jobs cannot overlap (e.g. one from push and one from schedule).
concurrency:
group: published-ci
cancel-in-progress: true

# Default to bash
defaults:
run:
shell: bash

jobs:
build:
name: Build and deploy to the published branch
runs-on: ubuntu-latest
env:
HUGO_VERSION: 0.123.0
steps:
- name: Install Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb

- name: Checkout
uses: actions/checkout@v4
with:
ref: 'master'
submodules: recursive
fetch-depth: 0

- name: Setup Pages
id: pages
uses: actions/configure-pages@v4

- name: Install Node.js dependencies
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"

- name: Build with Hugo
env:
# For maximum backward compatibility with Hugo modules
HUGO_ENVIRONMENT: production
HUGO_ENV: production
run: make build

- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: ./public

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
with:
ref: 'master'

# Configure the build environment.

- name: Install Ruby 3.1
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1'
# Runs 'bundle install' and caches installed gems automatically
bundler-cache: true

- name: Install Minify
run: sudo apt-get update && sudo apt-get install minify

# Build the website.

- name: Build the static website
run: bundle exec jekyll build

# Publish the build results

- name: Deploy to the published branch 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: published
folder: _site
# Configure the commit author.
git-config-name: 'Godot Organization'
git-config-email: '<>'
# Remove outdated files from the target directory.
clean: true
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v3
9 changes: 4 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# Build artifacts and cache
.bundle/
.jekyll-cache
.jekyll-metadata
_site
vendor/
public
tools/generators/node_modules
resources

# Code editors
.vscode/
Expand All @@ -12,6 +10,7 @@ vendor/
.htaccess
asset-library/
mirrorlist/
content/**/download/archive/
qa/

# OS-specific files
Expand Down
Empty file added .hugo_build.lock
Empty file.
9 changes: 0 additions & 9 deletions Gemfile

This file was deleted.

83 changes: 0 additions & 83 deletions Gemfile.lock

This file was deleted.

31 changes: 31 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
build: build-hugo index-articles

build-hugo: install-tools update-mirrorList update-download-archive
hugo --gc --minify

serve:
hugo server -D

serve-minify:
hugo server -D --minify

serve-nocache:
hugo server -D --ignoreCache --disableFastRender

serve-profile:
hugo server --templateMetrics --templateMetricsHints

serve-no-reload:
hugo server --disableLiveReload

install-tools:
cd ./tools/generators && npm install

update-mirrorList: install-tools
node ./tools/generators/src/mirror_list_generator.js

update-download-archive: install-tools
node ./tools/generators/src/download_archive_generator.js

index-articles:
npx --yes pagefind --site "public" --glob "**/article/*/*.{html}"
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,9 @@ To build the website locally, follow these steps:

1. Install [Jekyll prerequisites](https://jekyllrb.com/docs/installation/).
- Make sure `bundle` is available from the command line.
2. Install [Minify](https://github.com/tdewolff/minify/tree/master/cmd/minify).
- Make sure `minify` is available from the command line.
3. Clone this repository.
4. Install the necessary dependencies: `bundle install`.
5. Build the site: `bundle exec jekyll build`.
2. Clone this repository.
3. Install the necessary dependencies: `bundle install`.
4. Build the site: `bundle exec jekyll build`.
Comment on lines +37 to +38
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the readme needs to be updated as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'll leave it as the last step

- Append `--config _config.yml,_config.development.yml` to use the development config with your build.

For simplicity, these two commands are also available as a `build.sh` script in this repository.
Expand Down
7 changes: 0 additions & 7 deletions _config.development.yml

This file was deleted.

Loading