Skip to content

Commit

Permalink
refactor: Implement generic Jekyll site
Browse files Browse the repository at this point in the history
Signed-off-by: 林博仁(Buo-ren Lin) <buo.ren.lin@gmail.com>
  • Loading branch information
brlin-tw committed Oct 13, 2024
1 parent 93b925d commit c2485ff
Show file tree
Hide file tree
Showing 33 changed files with 678 additions and 120 deletions.
18 changes: 16 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# This file is based on The Common EditorConfig Template project
# https://github.com/the-common/editorconfig-template
#
# Copyright 2021 林博仁(Buo-ren, Lin) <Buo.Ren.Lin@gmail.com>
# Copyright 2024 林博仁(Buo-ren, Lin) <buo.ren.lin@gmail.com>
# SPDX-License-Identifier: WTFPL

# This is the top-most EditorConfig file
Expand All @@ -20,7 +20,7 @@ insert_final_newline = true
trim_trailing_whitespace = true

# Git configuration files uses tabs as indentation units
[.git*]
[/.git{modules,config}]
indent_style = tab

# Avoid git patch fail to apply due to stripped unmodified lines that contains only spaces
Expand Down Expand Up @@ -59,3 +59,17 @@ indent_size = 2

[.*.{yml,yaml}]
indent_size = 2

# Keep the indentation style of the license text verbatim
[/LICENSES/*]
indent_size = unset
indent_style = unset

[*.html]
indent_size = 2

[*.scss]
indent_size = 4

[Gemfile]
indent_size = 2
9 changes: 2 additions & 7 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,13 @@
# * Git - gitattributes Documentation
# https://www.git-scm.com/docs/gitattributes
#
# Copyright 2023 林博仁(Buo-ren, Lin) <Buo.Ren.Lin@gmail.com>
# Copyright 2024 林博仁(Buo-ren Lin) <buo.ren.lin@gmail.com>
# SPDX-License-Identifier: CC-BY-SA-4.0

# Avoid exporting development files to release archive
/.* export-ignore
/continuous-integration export-ignore
/docker-compose.yaml export-ignore

# Keep editorconfig for ease of editing of product files
/.editorconfig -export-ignore

# Keep REUSE DEP5 declaration file in the release archive for legal
# conformance
/.reuse/ -export-ignore
/.reuse/* export-ignore
/.reuse/dep5 -export-ignore
8 changes: 4 additions & 4 deletions .github/workflows/check-potential-problems.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# * Workflow syntax for GitHub Actions - GitHub Docs
# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions
#
# Copyright 2022 林博仁(Buo-ren, Lin) <Buo.Ren.Lin@gmail.com>
# Copyright 2024 林博仁(Buo-ren Lin) <buo.ren.lin@gmail.com>
# SPDX-License-Identifier: CC-BY-SA-4.0
name: Check potential problems in the project
on:
Expand All @@ -25,21 +25,21 @@ jobs:
uses: actions/checkout@v4

- name: Configure PyPI data cache to speed up continuous integration
uses: actions/cache@v3
uses: actions/cache@v4
with:
key: ${{ runner.os }}-pip
path: ${{ env.PIP_CACHE_DIR }}

- name: >-
Configure pre-commit data cache to speed up continuous integration
uses: actions/cache@v3
uses: actions/cache@v4
with:
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
path: ${{ env.PRE_COMMIT_HOME }}
- name: >-
Configure pre-built ShellCheck cache to speed up continuous integration
uses: actions/cache@v3
uses: actions/cache@v4
with:
key: ${{ runner.os }}-${{ runner.arch }}-shellcheck
path: ${{ env.SHELLCHECK_DIR }}
Expand Down
76 changes: 76 additions & 0 deletions .github/workflows/deploy-jekyll.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# GitHub Actions workflow for deploying Jekyll site to GitHub Pages
#
# References:
#
# * Workflow syntax for GitHub Actions - GitHub Docs
# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions
#
# Copyright 2024 林博仁(Buo-ren Lin) <buo.ren.lin@gmail.com>
# SPDX-License-Identifier: CC-BY-SA-4.0
name: Deploy Jekyll site to GitHub Pages

on:
# Runs on pushes targeting the default branch
push:
branches:
- main

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

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

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: pages
cancel-in-progress: false

jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3'
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
cache-version: 0 # Increment this number if you need to re-download cached gems
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
- name: Patch site URL
run: |-
sed \
--in-place \
--regexp-extended \
--expression='s@brlin\.me@brlin-tw.github.io@' \
_config.yml
- name: Build with Jekyll
# Outputs to the './_site' directory by default
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
env:
JEKYLL_ENV: production
- name: Upload artifact
# Automatically uploads an artifact from the './_site' directory by default
uses: actions/upload-pages-artifact@v3

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# * Workflow syntax for GitHub Actions - GitHub Docs
# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions
#
# Copyright 2023 林博仁(Buo-ren, Lin) <Buo.Ren.Lin@gmail.com>
# Copyright 2024 林博仁(Buo-ren Lin) <buo.ren.lin@gmail.com>
# SPDX-License-Identifier: CC-BY-SA-4.0
name: Release product and their build aritfacts
on:
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:
run: ./continuous-integration/generate-release-description.sh

- name: Publish the release archive to the GitHub Releases
uses: softprops/action-gh-release@v0.1.15
uses: softprops/action-gh-release@v2
with:
name: ${{ env.project_id }} ${{ env.release_version }}
files: |
Expand Down
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# This file is based on The Common .gitignore Templates
# https://github.com/the-common/gitignore-templates
#
# Copyright 2022 林博仁(Buo-ren, Lin) <Buo.Ren.Lin@gmail.com>
# Copyright 2024 林博仁(Buo-ren, Lin) <buo.ren.lin@gmail.com>
# SPDX-License-Identifier: CC-BY-SA-4.0

# Don't track regular Unix hidden files
Expand Down Expand Up @@ -64,9 +64,7 @@

# Don't track common export formats from Markdown
*.doc?
*.htm?
*.pdf
* odt

# Don't track common program output logs
*.err
Expand Down
37 changes: 36 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# * `.gitlab-ci.yml` keyword reference | GitLab
# https://docs.gitlab.com/ee/ci/yaml/
#
# Copyright 2023 林博仁(Buo-ren, Lin) <Buo.Ren.Lin@gmail.com>
# Copyright 2024 林博仁(Buo-ren Lin) <buo.ren.lin@gmail.com>
# SPDX-License-Identifier: CC-BY-SA-4.0
do-static-analysis:
stage: test
Expand Down Expand Up @@ -64,3 +64,38 @@ create-release:
- apk add bash git
- ./continuous-integration/generate-release-description.sh
- ./continuous-integration/create-gitlab-release.sh

test-pages:
stage: test
rules:
- if: $CI_COMMIT_TAG == null
image: ruby:latest
variables:
LC_ALL: C.UTF-8
before_script:
- gem install bundler
- bundle install
script:
- bundle exec jekyll build -d test
artifacts:
paths:
- test

pages:
stage: deploy
image: ruby:latest
rules:
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
needs:
- test-pages
variables:
JEKYLL_ENV: production
LC_ALL: C.UTF-8
before_script:
- gem install bundler
- bundle install
script:
- bundle exec jekyll build -d public
artifacts:
paths:
- public
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
# * Git - gitmodules Documentation
# https://git-scm.com/docs/gitmodules
#
# Copyright 2021 林博仁(Buo-ren, Lin) <Buo.Ren.Lin@gmail.com>
# Copyright 2024 林博仁(Buo-ren Lin) <buo.ren.lin@gmail.com>
# SPDX-License-Identifier: CC-BY-SA-4.0
32 changes: 19 additions & 13 deletions .markdownlint.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,50 @@
# Markdownlint(Node.js variant) configuration file
# https://github.com/igorshubovych/markdownlint-cli#configuration
#
# This file is based on The Common Markdownlint(Node.js variant) Configuration Templates project
# https://github.com/Lin-Buo-Ren/common-markdownlint-nodejs-config-templates
# This file is based on The Common Markdownlint(Node.js variant)
# Configuration Templates project
# https://github.com/the-common/markdownlint-nodejs-config-templates
#
# Copyright 2021 林博仁(Buo-ren, Lin) <Buo.Ren.Lin@gmail.com>
# Copyright 2024 林博仁(Buo-ren Lin) <buo.ren.lin@gmail.com>
# SPDX-License-Identifier: CC-BY-SA-4.0

# Inherit Markdownlint rules
default: True

# Only allow consistent un-ordered list bullet style(allow alternations in sub-levels)
MD004:
# Only allow consistent un-ordered list bullet style(allow alternations
# in sub-levels)
ul-style:
style: sublist

# Only allow 4 spaces as indentation of lists
MD007:
ul-indent:
indent: 4

# Only allow 2 spaces as linebreak sequence
MD009:
no-trailing-spaces:
br_spaces: 2

# Disable line length limitation(not suitable with CJK context)
MD013: False
line-length: False

# Allow missing padding blank line between the heading markup and the context
MD022: False
blanks-around-headings: False

# Allow duplicated non-sibling heading text
MD024:
no-duplicate-heading:
siblings_only: True

# Allow missing padding blank line between a list and its context
MD032: False
blanks-around-lists: False

# Allow using raw HTML markups as workarounds of deficiencies of Markdown
MD033: False
no-inline-html: False

# Allow using YAML front matter, while not require the definition of the
# `title` property
MD041:
first-line-h1:
front_matter_title: '.*'

single-title:
# Workaround for the layouts step
front_matter_title: ''
18 changes: 15 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# This file is based on The Common Pre-commit Framework Configuration Template
# https://github.com/Lin-Buo-Ren/common-precommit-config-template
#
# Copyright 2021 林博仁(Buo-ren, Lin) <Buo.Ren.Lin@gmail.com>
# Copyright 2024 林博仁(Buo-ren, Lin) <buo.ren.lin@gmail.com>
# SPDX-License-Identifier: CC-BY-SA-4.0

repos:
Expand Down Expand Up @@ -35,14 +35,14 @@ repos:
# Check Markdown documents with Markdownlint(Node.js variant)
# https://github.com/DavidAnson/markdownlint
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.23.2
rev: v0.34.0
hooks:
- id: markdownlint

# Check REUSE compliance
# https://reuse.software/
- repo: https://github.com/fsfe/reuse-tool
rev: v1.0.0
rev: v4.0.3
hooks:
- id: reuse

Expand All @@ -61,3 +61,15 @@ repos:
rev: v1.30.0
hooks:
- id: yamllint

# Check EditorConfig style compliance
# https://github.com/editorconfig-checker/editorconfig-checker.python
- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
rev: 2.7.3
hooks:
- id: editorconfig-checker
alias: ec
exclude: |
(?ix)^(
LICENSES/.*
)$
11 changes: 0 additions & 11 deletions .reuse/dep5

This file was deleted.

2 changes: 1 addition & 1 deletion .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# This file is based on The Unofficial yamllint Configuration Templates
# https://github.com/Lin-Buo-Ren/yamllint-configuration-templates
#
# Copyright 2021 林博仁(Buo-ren, Lin) <Buo.Ren.Lin@gmail.com>
# Copyright 2024 林博仁(Buo-ren, Lin) <buo.ren.lin@gmail.com>
# SPDX-License-Identifier: CC-BY-SA-4.0
rules:
# Use this rule to control the number of spaces inside braces (`{` and `}`).
Expand Down
Loading

0 comments on commit c2485ff

Please sign in to comment.