Skip to content

Commit 23e8562

Browse files
authored
Initial commit
0 parents  commit 23e8562

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+2747
-0
lines changed

.github/FUNDING.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github: gcushen
2+
custom: https://hugoblox.com/sponsor/

.github/preview.webp

48.4 KB
Loading

.github/workflows/deploy.yml

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
name: Deploy website to GitHub Pages
2+
3+
env:
4+
WC_HUGO_VERSION: '0.150.0'
5+
NODE_VERSION: '20'
6+
7+
on:
8+
# Trigger the workflow every time you push to the `main` branch
9+
push:
10+
branches: ['main']
11+
# Allows you to run this workflow manually from the Actions tab on GitHub
12+
workflow_dispatch:
13+
14+
# Provide permission to clone the repo and deploy it to GitHub Pages
15+
permissions:
16+
contents: read
17+
pages: write
18+
id-token: write
19+
20+
concurrency:
21+
group: 'pages'
22+
cancel-in-progress: false
23+
24+
jobs:
25+
# Build website
26+
build:
27+
if: github.repository_owner != 'HugoBlox'
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
with:
33+
# Fetch history for Hugo's .GitInfo and .Lastmod
34+
fetch-depth: 0
35+
36+
- name: Setup Node.js
37+
uses: actions/setup-node@v4
38+
with:
39+
node-version: ${{ env.NODE_VERSION }}
40+
41+
- name: Setup pnpm
42+
if: hashFiles('package.json') != ''
43+
uses: pnpm/action-setup@v4
44+
45+
- name: Install dependencies
46+
run: |
47+
# Install Tailwind CLI if package.json exists
48+
if [ -f "package.json" ]; then
49+
echo "Installing Tailwind dependencies..."
50+
pnpm install || npm install
51+
fi
52+
53+
- name: Setup Hugo
54+
uses: peaceiris/actions-hugo@v3
55+
with:
56+
hugo-version: ${{ env.WC_HUGO_VERSION }}
57+
extended: true
58+
59+
# Cache dependencies (Go modules, node_modules) - stable, rarely changes
60+
- uses: actions/cache@v4
61+
with:
62+
path: |
63+
/tmp/hugo_cache_runner/
64+
node_modules/
65+
modules/*/node_modules/
66+
key: ${{ runner.os }}-hugo-deps-${{ hashFiles('**/go.mod', '**/package-lock.json',
67+
'**/pnpm-lock.yaml') }}
68+
restore-keys: |
69+
${{ runner.os }}-hugo-deps-
70+
71+
# Cache Hugo resources (processed images, CSS) - invalidates only when assets/config change
72+
- uses: actions/cache@v4
73+
with:
74+
path: resources/
75+
key: ${{ runner.os }}-hugo-resources-${{ hashFiles('assets/**/*', 'config/**/*',
76+
'hugo.yaml', 'package.json') }}
77+
restore-keys: |
78+
${{ runner.os }}-hugo-resources-
79+
80+
- name: Setup Pages
81+
id: pages
82+
uses: actions/configure-pages@v5
83+
84+
- name: Build with Hugo
85+
env:
86+
HUGO_ENVIRONMENT: production
87+
run: |
88+
echo "Hugo Cache Dir: $(hugo config | grep cachedir)"
89+
hugo --minify --baseURL "${{ steps.pages.outputs.base_url }}/"
90+
91+
- name: Generate Pagefind search index (if applicable)
92+
run: |
93+
# Check if site uses Pagefind search
94+
if [ -f "package.json" ] && grep -q "pagefind" package.json; then
95+
pnpm dlx pagefind --source "public" || npx pagefind --source "public"
96+
fi
97+
98+
- name: Upload artifact
99+
uses: actions/upload-pages-artifact@v4
100+
with:
101+
path: ./public
102+
103+
# Deploy website to GitHub Pages hosting
104+
deploy:
105+
if: github.repository_owner != 'HugoBlox'
106+
needs: build
107+
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
108+
permissions:
109+
pages: write # to deploy to Pages
110+
id-token: write # to verify the deployment originates from an appropriate source
111+
# Deploy to the github-pages environment
112+
environment:
113+
name: github-pages
114+
url: ${{ steps.deployment.outputs.page_url }}
115+
runs-on: ubuntu-latest
116+
steps:
117+
- name: Deploy to GitHub Pages
118+
id: deployment
119+
uses: actions/deploy-pages@v4
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# Hugo Blox GitHub Action to convert Bibtex publications to Markdown-based webpages
2+
name: Import Publications From Bibtex
3+
4+
# Require permission to create a PR (least privilege principle)
5+
permissions:
6+
contents: write
7+
pull-requests: write
8+
9+
# Run workflow when a `.bib` file is added or updated in the `data/` folder
10+
on:
11+
push:
12+
branches: ['main']
13+
paths: ['publications.bib']
14+
15+
# Allows you to run this workflow manually from the Actions tab
16+
workflow_dispatch:
17+
18+
# Prevent concurrent runs of this workflow
19+
concurrency:
20+
group: import-publications-${{ github.ref }}
21+
cancel-in-progress: true
22+
23+
jobs:
24+
hugoblox:
25+
if: github.repository_owner != 'HugoBlox'
26+
runs-on: ubuntu-latest
27+
timeout-minutes: 10
28+
29+
env:
30+
ACADEMIC_VERSION: '>=0.10.0'
31+
PYTHON_VERSION: '3.12'
32+
steps:
33+
- name: Checkout the repo
34+
uses: actions/checkout@v4
35+
with:
36+
# Only need recent history for publication import
37+
fetch-depth: 1
38+
39+
- name: Set up Python 3.13
40+
uses: actions/setup-python@v5
41+
with:
42+
python-version: '3.12'
43+
- name: Setup pip cache
44+
uses: actions/cache@v4
45+
with:
46+
path: ~/.cache/pip
47+
key: ${{ runner.os }}-pip-academic-${{ env.ACADEMIC_VERSION }}
48+
restore-keys: |
49+
${{ runner.os }}-pip-academic-
50+
${{ runner.os }}-pip-
51+
52+
- name: Install dependencies
53+
run: |
54+
python -m pip install --upgrade pip
55+
pip install "academic${{ env.ACADEMIC_VERSION }}"
56+
- name: Validate publications.bib file
57+
if: ${{ hashFiles('publications.bib') != '' }}
58+
run: |
59+
if [ ! -f "publications.bib" ]; then
60+
echo "❌ publications.bib file not found"
61+
exit 1
62+
fi
63+
echo "✅ publications.bib file found"
64+
65+
- name: Run Academic (Bibtex To Markdown Converter)
66+
# Check `.bib` file exists for case when action runs on `.bib` deletion
67+
# Note GH only provides hashFiles func in `steps.if` context, not `jobs.if` context
68+
if: ${{ hashFiles('publications.bib') != '' }}
69+
run: |
70+
echo "🚀 Starting publication import..."
71+
academic import publications.bib content/publication/ --compact --verbose
72+
echo "✅ Publication import completed successfully"
73+
74+
# Verify that files were created
75+
if [ -d "content/publication" ] && [ "$(ls -A content/publication/)" ]; then
76+
echo "📚 Publications imported: $(ls content/publication/ | wc -l) items"
77+
else
78+
echo "⚠️ No publications were imported"
79+
fi
80+
continue-on-error: false
81+
- name: Create Pull Request
82+
# Set ID for `Check outputs` stage
83+
id: cpr
84+
uses: peter-evans/create-pull-request@v6
85+
with:
86+
commit-message: 'feat(publications): import latest publications from bibtex'
87+
title: 'Hugo Blox Builder - Import latest publications from Bibtex'
88+
body: |
89+
🔄 **Automated Publication Import**
90+
91+
This PR automatically imports the latest publications from `publications.bib` to `content/publication/`.
92+
93+
**Changes:**
94+
- 📚 Updated publication entries
95+
- 🏷️ Processed bibliographic data
96+
97+
---
98+
将最新的出版物从`publications.bib`导入到`content/publication/`。
99+
100+
📖 [View Documentation](https://github.com/GetRD/academic-file-converter)
101+
base: main
102+
labels: automated-pr, content, publications
103+
branch: hugoblox-import-publications
104+
delete-branch: true
105+
draft: false
106+
- name: Check outputs
107+
if: ${{ steps.cpr.outputs.pull-request-number }}
108+
run: |
109+
echo "✅ Successfully created Pull Request!"
110+
echo "📝 Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
111+
echo "🔗 Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
112+
echo "🎯 Operation completed at $(date)"
113+
114+
- name: Report workflow status
115+
if: always()
116+
run: |
117+
if [ "${{ job.status }}" == "success" ]; then
118+
echo "🎉 Workflow completed successfully"
119+
else
120+
echo "❌ Workflow failed - check logs for details"
121+
exit 1
122+
fi

.github/workflows/updater-wip.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# This workflow is only for the Hugo Blox repository. It is safe to delete from your site.
2+
name: Updater (WIP)
3+
4+
on:
5+
schedule:
6+
- cron: 0 0 * * 0
7+
# Allows you to run this workflow manually from the Actions tab on GitHub.
8+
workflow_dispatch:
9+
10+
# Provide permission to clone the repo and deploy it to GitHub Pages
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
update:
16+
if: github.repository_owner == 'HugoBlox'
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: HugoBlox/gh-action-updater@v2
20+
with:
21+
feed-url: https://hugoblox.com/rss.xml
22+
readme-section: news
23+
branch: main
24+
github_token: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# ============================================================================
2+
# Hugo Site .gitignore
3+
# ============================================================================
4+
5+
# ============================================================================
6+
# Hugo Build Artifacts
7+
# ============================================================================
8+
9+
# Generated site output
10+
public/
11+
12+
# Hugo resources (processed assets)
13+
resources/
14+
15+
# Hugo build lock
16+
.hugo_build.lock
17+
18+
# Hugo stats
19+
hugo_stats.json
20+
21+
# Auto-generated JS config
22+
**/assets/jsconfig.json
23+
24+
# ============================================================================
25+
# Node.js & Package Managers
26+
# ============================================================================
27+
28+
# Dependencies
29+
node_modules/
30+
31+
# ============================================================================
32+
# Environment & Configuration
33+
# ============================================================================
34+
35+
# Environment variables
36+
.env
37+
.env.local
38+
.env.*.local
39+
40+
# ============================================================================
41+
# Development Tools
42+
# ============================================================================
43+
44+
# IDE & Editors
45+
.vscode/
46+
.idea/
47+
48+
# ============================================================================
49+
# Generated Content
50+
# ============================================================================
51+
52+
# Pagefind search index
53+
pagefind/
54+
static/pagefind/
55+
56+
# ============================================================================
57+
# Operating System
58+
# ============================================================================
59+
60+
# macOS
61+
.DS_Store
62+
.DS_Store?
63+
._*
64+
65+
# Windows
66+
Thumbs.db
67+
Desktop.ini
68+
69+
# Linux
70+
*~
71+
72+
# ============================================================================
73+
# Logs & Temporary Files
74+
# ============================================================================
75+
76+
*.log
77+
npm-debug.log*

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023-present George Cushen (https://georgecushen.com/)
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)