Skip to content
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
166 changes: 147 additions & 19 deletions .github/workflows/run.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,161 @@
name: Build and deploy Jekyll site to GitHub Pages
name: Build and Deploy Cypherpunks Taiwan V2.0

on:
push:
branches:
- master
pull_request:
branches:
- master

# Sets permissions of the GITHUB_TOKEN
permissions:
contents: write
pages: write
id-token: write

# Allow only one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true

jobs:
build-and-deploy:
runs-on: ubuntu-22.04
permissions:
contents: write
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
- name: Checkout repository
uses: actions/checkout@v4

# Setup Node.js for Tailwind CSS
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Install Node dependencies
run: npm ci || npm install

- name: Build Tailwind CSS
run: npm run css:build

# Setup Ruby for Jekyll
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
ruby-version: '3.2'
bundler-cache: true
- name: Install dependencies

- name: Install Ruby dependencies
run: |
bundle config unset deployment
sudo gem install bundler:2.2.15
bundle install
bundle add kramdown-parser-gfm
bundle install
- name: Build site
run: bundle exec jekyll build
bundle config set --local path 'vendor/bundle'
bundle install --jobs 4 --retry 3

- name: Build Jekyll site
run: |
# Check if this is a project page (repo name != owner.github.io)
REPO_NAME="${GITHUB_REPOSITORY#*/}"
OWNER="${GITHUB_REPOSITORY_OWNER}"
if [[ "$REPO_NAME" != "${OWNER}.github.io" ]]; then
echo "Building for project page: baseurl=/${REPO_NAME}"
bundle exec jekyll build --baseurl "/${REPO_NAME}"
else
echo "Building for user/org page: no baseurl"
bundle exec jekyll build
fi
env:
JEKYLL_ENV: production

- name: Build Pagefind search index
run: npx pagefind --site _site --output-path _site/pagefind

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./_site

deploy:
if: github.ref == 'refs/heads/master'
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
id: deployment
uses: actions/deploy-pages@v4

# Quality Checks (run on PRs)
quality-check:
if: github.event_name == 'pull_request'
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Download artifact
uses: actions/download-artifact@v4
with:
name: github-pages
path: _site

- name: Extract artifact
run: |
cd _site
tar -xvf artifact.tar
rm artifact.tar

# Link Checker
- name: Check links
uses: lycheeverse/lychee-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./_site
args: --verbose --no-progress --accept 999 './_site/**/*.html'
fail: false

# HTML Validation
- name: Setup Node.js for html-validate
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install html-validate
run: npm install -g html-validate

- name: Validate HTML
run: |
html-validate --config .htmlvalidate.json "_site/**/*.html" || true
continue-on-error: true

# Accessibility Check
- name: Install pa11y
run: npm install -g pa11y-ci

- name: Run accessibility check
run: |
pa11y-ci --config .pa11yci.json || true
continue-on-error: true

# Image Compression (run on PRs with image changes)
compress-images:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Compress Images
id: compress
uses: calibreapp/image-actions@main
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
compressOnly: true
ignorePaths: 'node_modules/**,vendor/**,_site/**'
continue-on-error: true

- name: Create image compression summary
if: steps.compress.outputs.markdown != ''
run: |
echo "## Image Compression Results" >> $GITHUB_STEP_SUMMARY
echo "${{ steps.compress.outputs.markdown }}" >> $GITHUB_STEP_SUMMARY
22 changes: 22 additions & 0 deletions .htmlvalidate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"extends": ["html-validate:recommended"],
"rules": {
"no-trailing-whitespace": "off",
"void-style": "off",
"prefer-native-element": "off",
"no-inline-style": "off",
"require-sri": "off",
"script-type": "off",
"attribute-allowed-values": "off",
"element-permitted-content": "warn",
"no-unknown-elements": "warn",
"wcag/h30": "warn",
"wcag/h32": "warn",
"wcag/h36": "warn",
"wcag/h37": "warn",
"wcag/h67": "warn"
},
"transform": {
"^.*\\.html$": "html-validate:plain"
}
}
18 changes: 18 additions & 0 deletions .pa11yci.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"defaults": {
"timeout": 30000,
"wait": 500,
"standard": "WCAG2AA",
"runners": ["axe"],
"chromeLaunchConfig": {
"args": ["--no-sandbox", "--disable-setuid-sandbox"]
}
},
"urls": [
"http://localhost:4000/",
"http://localhost:4000/blog/",
"http://localhost:4000/tags/",
"http://localhost:4000/categories/",
"http://localhost:4000/archive/"
]
}
24 changes: 19 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
# frozen_string_literal: true

source "https://rubygems.org"
gemspec

# Jekyll 4.x
gem "jekyll", "~> 4.3"

# Jekyll plugins
group :jekyll_plugins do
gem "jekyll-feed", "~> 0.6"
gem "jekyll-sitemap"
gem "jekyll-paginate"
gem "jekyll-seo-tag"
gem "jekyll-feed", "~> 0.17"
gem "jekyll-sitemap", "~> 1.4"
gem "jekyll-paginate", "~> 1.1"
gem "jekyll-seo-tag", "~> 2.8"
gem "kramdown-parser-gfm", "~> 1.1"
end

# Performance
gem "webrick", "~> 1.8" # Required for Ruby 3.0+

# Windows specific
platforms :mingw, :x64_mingw, :mswin, :jruby do
gem "tzinfo", ">= 1", "< 3"
gem "tzinfo-data"
end

gem "wdm", "~> 0.1", :platforms => [:mingw, :x64_mingw, :mswin]
Loading
Loading