Skip to content

Deploy Jekyll site to Pages #106

Deploy Jekyll site to Pages

Deploy Jekyll site to Pages #106

Workflow file for this run

name: Deploy Jekyll site to Pages
on:
push:
branches: ["main", "master"]
schedule:
# Rebuild daily at 00:10 UTC so newly cron-pushed signals appear
- cron: "10 0 * * *"
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Mirror signals/ to _signals/ for Jekyll collection
run: |
mkdir -p _signals
# Flatten signals/YYYY/MM-DD.md -> _signals/YYYY-MM-DD.md and inject front matter
if [ -d signals ]; then
find signals -type f -name "*.md" | while read f; do
year=$(basename "$(dirname "$f")")
file=$(basename "$f") # e.g. 04-22.md
md_day="${file%.md}" # 04-22
date="${year}-${md_day}" # 2026-04-22
# Extract first H1 as title, fallback to date
title=$(grep -m1 '^# ' "$f" | sed 's/^# //' || true)
[ -z "$title" ] && title="OPC日报 $date"
out="_signals/${date}.md"
{
echo "---"
echo "layout: signal"
echo "title: \"${title}\""
echo "date: ${date}"
echo "permalink: /signals/${date}/"
echo "---"
echo ""
cat "$f"
} > "$out"
done
fi
ls -la _signals/ || true
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: true
- name: Setup Pages
id: pages
uses: actions/configure-pages@v4
- name: Build with Jekyll
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
env:
JEKYLL_ENV: production
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./_site
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