ci(starters): upgrade
This commit is contained in:
105
.github/workflows/deploy.yml
vendored
Normal file
105
.github/workflows/deploy.yml
vendored
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
name: Deploy website to GitHub Pages
|
||||||
|
|
||||||
|
env:
|
||||||
|
WC_HUGO_VERSION: '0.148.2'
|
||||||
|
NODE_VERSION: '20'
|
||||||
|
|
||||||
|
on:
|
||||||
|
# Trigger the workflow every time you push to the `main` branch
|
||||||
|
push:
|
||||||
|
branches: ['main']
|
||||||
|
# Allows you to run this workflow manually from the Actions tab on GitHub.
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
# Provide permission to clone the repo and deploy it to GitHub Pages
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pages: write
|
||||||
|
id-token: write
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: 'pages'
|
||||||
|
cancel-in-progress: false
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# Build website
|
||||||
|
build:
|
||||||
|
if: github.repository_owner != 'HugoBlox'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
# Fetch history for Hugo's .GitInfo and .Lastmod
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: ${{ env.NODE_VERSION }}
|
||||||
|
|
||||||
|
- name: Setup pnpm
|
||||||
|
if: hashFiles('package.json') != ''
|
||||||
|
uses: pnpm/action-setup@v4
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
# Install Tailwind CLI if package.json exists
|
||||||
|
if [ -f "package.json" ]; then
|
||||||
|
echo "Installing Tailwind dependencies..."
|
||||||
|
pnpm install || npm install
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Setup Hugo
|
||||||
|
uses: peaceiris/actions-hugo@v3
|
||||||
|
with:
|
||||||
|
hugo-version: ${{ env.WC_HUGO_VERSION }}
|
||||||
|
extended: true
|
||||||
|
|
||||||
|
- uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
/tmp/hugo_cache_runner/
|
||||||
|
node_modules/
|
||||||
|
modules/*/node_modules/
|
||||||
|
key: ${{ runner.os }}-hugomod-${{ hashFiles('**/go.mod', '**/package-lock.json', '**/pnpm-lock.yaml') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-hugomod-
|
||||||
|
|
||||||
|
- name: Setup Pages
|
||||||
|
id: pages
|
||||||
|
uses: actions/configure-pages@v5
|
||||||
|
|
||||||
|
- name: Build with Hugo
|
||||||
|
env:
|
||||||
|
HUGO_ENVIRONMENT: production
|
||||||
|
run: |
|
||||||
|
echo "Hugo Cache Dir: $(hugo config | grep cachedir)"
|
||||||
|
hugo --minify --baseURL "${{ steps.pages.outputs.base_url }}/"
|
||||||
|
|
||||||
|
- name: Generate Pagefind search index (if applicable)
|
||||||
|
run: |
|
||||||
|
# Check if site uses Pagefind
|
||||||
|
if [ -f "package.json" ] && grep -q "pagefind" package.json; then
|
||||||
|
pnpm dlx pagefind --source "public" || npx pagefind --source "public"
|
||||||
|
elif [ -f "netlify.toml" ] && grep -q "pagefind" netlify.toml; then
|
||||||
|
pnpm dlx pagefind --source "public" || npx pagefind --source "public"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Upload artifact
|
||||||
|
uses: actions/upload-pages-artifact@v4
|
||||||
|
with:
|
||||||
|
path: ./public
|
||||||
|
|
||||||
|
# Deploy website to GitHub Pages hosting
|
||||||
|
deploy:
|
||||||
|
if: github.repository_owner != 'HugoBlox'
|
||||||
|
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
|
||||||
73
.github/workflows/import-publications.yml
vendored
73
.github/workflows/import-publications.yml
vendored
@@ -1,10 +1,11 @@
|
|||||||
# Hugo Blox GitHub Action to convert Bibtex publications to Markdown-based webpages
|
# Hugo Blox GitHub Action to convert Bibtex publications to Markdown-based webpages
|
||||||
name: Import Publications From Bibtex
|
name: Import Publications From Bibtex
|
||||||
|
|
||||||
# Require permission to create a PR
|
# Require permission to create a PR (least privilege principle)
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
|
metadata: read
|
||||||
|
|
||||||
# Run workflow when a `.bib` file is added or updated in the `data/` folder
|
# Run workflow when a `.bib` file is added or updated in the `data/` folder
|
||||||
on:
|
on:
|
||||||
@@ -19,39 +20,81 @@ jobs:
|
|||||||
hugoblox:
|
hugoblox:
|
||||||
if: github.repository_owner != 'HugoBlox'
|
if: github.repository_owner != 'HugoBlox'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 10
|
||||||
|
|
||||||
|
env:
|
||||||
|
ACADEMIC_VERSION: '>=0.10.0'
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout the repo
|
- name: Checkout the repo
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Set up Python 3.12
|
|
||||||
uses: actions/setup-python@v4
|
|
||||||
with:
|
with:
|
||||||
python-version: "3.12"
|
# Fetch history for better performance and debugging
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Set up Python 3.13
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: '3.13'
|
||||||
|
- name: Setup pip cache
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: ~/.cache/pip
|
||||||
|
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
pip install academic==0.10.0
|
pip install academic${{ env.ACADEMIC_VERSION }}
|
||||||
- name: Run Academic (Bibtex To Markdown Converter)
|
- name: Run Academic (Bibtex To Markdown Converter)
|
||||||
# Check `.bib` file exists for case when action runs on `.bib` deletion
|
# Check `.bib` file exists for case when action runs on `.bib` deletion
|
||||||
# Note GH only provides hashFiles func in `steps.if` context, not `jobs.if` context
|
# Note GH only provides hashFiles func in `steps.if` context, not `jobs.if` context
|
||||||
if: ${{ hashFiles('publications.bib') != '' }}
|
if: ${{ hashFiles('publications.bib') != '' }}
|
||||||
run: academic import publications.bib content/publication/ --compact
|
run: |
|
||||||
|
echo "Starting publication import..."
|
||||||
|
academic import publications.bib content/publication/ --compact
|
||||||
|
echo "Publication import completed successfully"
|
||||||
|
continue-on-error: false
|
||||||
- name: Create Pull Request
|
- name: Create Pull Request
|
||||||
# Set ID for `Check outputs` stage
|
# Set ID for `Check outputs` stage
|
||||||
id: cpr
|
id: cpr
|
||||||
uses: peter-evans/create-pull-request@v5
|
uses: peter-evans/create-pull-request@v6
|
||||||
with:
|
with:
|
||||||
commit-message: 'content: import publications from Bibtex'
|
commit-message: 'content(publications): run Hugo Blox importer to import publications from Bibtex'
|
||||||
title: Hugo Blox Builder - Import latest publications
|
title: 'Hugo Blox Builder - Import latest publications from Bibtex'
|
||||||
body: |
|
body: |
|
||||||
Import the latest publications from `publications.bib` to `content/publication/`.
|
🔄 **Automated Publication Import**
|
||||||
|
|
||||||
|
This PR automatically imports the latest publications from `publications.bib` to `content/publication/`.
|
||||||
|
|
||||||
|
**Changes:**
|
||||||
|
- 📚 Updated publication entries
|
||||||
|
- 🏷️ Processed bibliographic data
|
||||||
|
|
||||||
|
---
|
||||||
将最新的出版物从`publications.bib`导入到`content/publication/`。
|
将最新的出版物从`publications.bib`导入到`content/publication/`。
|
||||||
[View Documentation](https://github.com/GetRD/academic-file-converter)
|
|
||||||
|
📖 [View Documentation](https://github.com/GetRD/academic-file-converter)
|
||||||
base: main
|
base: main
|
||||||
labels: automated-pr, content
|
labels: automated-pr, content, publications
|
||||||
branch: hugoblox-import-publications
|
branch: hugoblox-import-publications
|
||||||
delete-branch: true
|
delete-branch: true
|
||||||
|
draft: false
|
||||||
- name: Check outputs
|
- name: Check outputs
|
||||||
if: ${{ steps.cpr.outputs.pull-request-number }}
|
if: ${{ steps.cpr.outputs.pull-request-number }}
|
||||||
run: |
|
run: |
|
||||||
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
|
echo "✅ Successfully created Pull Request!"
|
||||||
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
|
echo "📝 Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
|
||||||
|
echo "🔗 Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
|
||||||
|
echo "🎯 Operation completed at $(date)"
|
||||||
|
|
||||||
|
- name: Report workflow status
|
||||||
|
if: always()
|
||||||
|
run: |
|
||||||
|
if [ "${{ job.status }}" == "success" ]; then
|
||||||
|
echo "🎉 Workflow completed successfully"
|
||||||
|
else
|
||||||
|
echo "❌ Workflow failed - check logs for details"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|||||||
105
.github/workflows/publish.yaml
vendored
105
.github/workflows/publish.yaml
vendored
@@ -1,105 +0,0 @@
|
|||||||
name: Deploy website to GitHub Pages
|
|
||||||
|
|
||||||
env:
|
|
||||||
WC_HUGO_VERSION: '0.148.2'
|
|
||||||
NODE_VERSION: '20'
|
|
||||||
|
|
||||||
on:
|
|
||||||
# Trigger the workflow every time you push to the `main` branch
|
|
||||||
push:
|
|
||||||
branches: ["main"]
|
|
||||||
# Allows you to run this workflow manually from the Actions tab on GitHub.
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
# Provide permission to clone the repo and deploy it to GitHub Pages
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
pages: write
|
|
||||||
id-token: write
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: "pages"
|
|
||||||
cancel-in-progress: false
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
# Build website
|
|
||||||
build:
|
|
||||||
if: github.repository_owner != 'HugoBlox'
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
# Fetch history for Hugo's .GitInfo and .Lastmod
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Setup Node.js
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: ${{ env.NODE_VERSION }}
|
|
||||||
|
|
||||||
- name: Setup pnpm
|
|
||||||
if: hashFiles('package.json') != ''
|
|
||||||
uses: pnpm/action-setup@v4
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
# Install Tailwind CLI if package.json exists
|
|
||||||
if [ -f "package.json" ]; then
|
|
||||||
echo "Installing Tailwind dependencies..."
|
|
||||||
pnpm install || npm install
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Setup Hugo
|
|
||||||
uses: peaceiris/actions-hugo@v3
|
|
||||||
with:
|
|
||||||
hugo-version: ${{ env.WC_HUGO_VERSION }}
|
|
||||||
extended: true
|
|
||||||
|
|
||||||
- uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
/tmp/hugo_cache_runner/
|
|
||||||
node_modules/
|
|
||||||
modules/*/node_modules/
|
|
||||||
key: ${{ runner.os }}-hugomod-${{ hashFiles('**/go.mod', '**/package-lock.json', '**/pnpm-lock.yaml') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-hugomod-
|
|
||||||
|
|
||||||
- name: Setup Pages
|
|
||||||
id: pages
|
|
||||||
uses: actions/configure-pages@v5
|
|
||||||
|
|
||||||
- name: Build with Hugo
|
|
||||||
env:
|
|
||||||
HUGO_ENVIRONMENT: production
|
|
||||||
run: |
|
|
||||||
echo "Hugo Cache Dir: $(hugo config | grep cachedir)"
|
|
||||||
hugo --minify --baseURL "${{ steps.pages.outputs.base_url }}/"
|
|
||||||
|
|
||||||
- name: Generate Pagefind search index (if applicable)
|
|
||||||
run: |
|
|
||||||
# Check if site uses Pagefind
|
|
||||||
if [ -f "package.json" ] && grep -q "pagefind" package.json; then
|
|
||||||
pnpm dlx pagefind --source "public" || npx pagefind --source "public"
|
|
||||||
elif [ -f "netlify.toml" ] && grep -q "pagefind" netlify.toml; then
|
|
||||||
pnpm dlx pagefind --source "public" || npx pagefind --source "public"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Upload artifact
|
|
||||||
uses: actions/upload-pages-artifact@v3
|
|
||||||
with:
|
|
||||||
path: ./public
|
|
||||||
|
|
||||||
# Deploy website to GitHub Pages hosting
|
|
||||||
deploy:
|
|
||||||
if: github.repository_owner != 'HugoBlox'
|
|
||||||
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
|
|
||||||
Reference in New Issue
Block a user