ci(starters): upgrade

This commit is contained in:
Splitter
2025-08-23 01:09:50 +00:00
parent 5344f35fa8
commit 253063a60c
3 changed files with 163 additions and 120 deletions

View File

@@ -1,10 +1,11 @@
# Hugo Blox GitHub Action to convert Bibtex publications to Markdown-based webpages
name: Import Publications From Bibtex
# Require permission to create a PR
# Require permission to create a PR (least privilege principle)
permissions:
contents: write
pull-requests: write
metadata: read
# Run workflow when a `.bib` file is added or updated in the `data/` folder
on:
@@ -19,39 +20,81 @@ jobs:
hugoblox:
if: github.repository_owner != 'HugoBlox'
runs-on: ubuntu-latest
timeout-minutes: 10
env:
ACADEMIC_VERSION: '>=0.10.0'
steps:
- name: Checkout the repo
uses: actions/checkout@v3
- name: Set up Python 3.12
uses: actions/setup-python@v4
uses: actions/checkout@v4
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
run: |
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)
# 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
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
# Set ID for `Check outputs` stage
id: cpr
uses: peter-evans/create-pull-request@v5
uses: peter-evans/create-pull-request@v6
with:
commit-message: 'content: import publications from Bibtex'
title: Hugo Blox Builder - Import latest publications
commit-message: 'content(publications): run Hugo Blox importer to import publications from Bibtex'
title: 'Hugo Blox Builder - Import latest publications from Bibtex'
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/`。
[View Documentation](https://github.com/GetRD/academic-file-converter)
📖 [View Documentation](https://github.com/GetRD/academic-file-converter)
base: main
labels: automated-pr, content
labels: automated-pr, content, publications
branch: hugoblox-import-publications
delete-branch: true
draft: false
- name: Check outputs
if: ${{ steps.cpr.outputs.pull-request-number }}
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
echo "✅ Successfully created Pull Request!"
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