Skip to content

Commit ae8ebcd

Browse files
committed
Added workflows to main
1 parent fd08d09 commit ae8ebcd

File tree

3 files changed

+149
-0
lines changed

3 files changed

+149
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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
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+
jobs:
19+
hugoblox:
20+
if: github.repository_owner != 'HugoBlox'
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout the repo
24+
uses: actions/checkout@v3
25+
- name: Set up Python 3.12
26+
uses: actions/setup-python@v4
27+
with:
28+
python-version: "3.12"
29+
- name: Install dependencies
30+
run: |
31+
python -m pip install --upgrade pip
32+
pip install academic==0.10.0
33+
- name: Run Academic (Bibtex To Markdown Converter)
34+
# Check `.bib` file exists for case when action runs on `.bib` deletion
35+
# Note GH only provides hashFiles func in `steps.if` context, not `jobs.if` context
36+
if: ${{ hashFiles('publications.bib') != '' }}
37+
run: academic import publications.bib content/publication/ --compact
38+
- name: Create Pull Request
39+
# Set ID for `Check outputs` stage
40+
id: cpr
41+
uses: peter-evans/create-pull-request@v5
42+
with:
43+
commit-message: 'content: import publications from Bibtex'
44+
title: Hugo Blox Builder - Import latest publications
45+
body: |
46+
Import the latest publications from `publications.bib` to `content/publication/`.
47+
将最新的出版物从`publications.bib`导入到`content/publication/`。
48+
[View Documentation](https://github.com/GetRD/academic-file-converter)
49+
base: main
50+
labels: automated-pr, content
51+
branch: hugoblox-import-publications
52+
delete-branch: true
53+
- name: Check outputs
54+
if: ${{ steps.cpr.outputs.pull-request-number }}
55+
run: |
56+
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
57+
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"

.github/workflows/publish.yaml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Deploy website to GitHub Pages
2+
3+
env:
4+
WC_HUGO_VERSION: '0.119.0'
5+
6+
on:
7+
# Trigger the workflow every time you push to the `main` branch
8+
push:
9+
branches: ["main"]
10+
# Allows you to run this workflow manually from the Actions tab on GitHub.
11+
workflow_dispatch:
12+
13+
# Provide permission to clone the repo and deploy it to GitHub Pages
14+
permissions:
15+
contents: read
16+
pages: write
17+
id-token: write
18+
19+
concurrency:
20+
group: "pages"
21+
cancel-in-progress: false
22+
23+
jobs:
24+
# Build website
25+
build:
26+
if: github.repository_owner != 'HugoBlox'
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v4
31+
with:
32+
# Fetch history for Hugo's .GitInfo and .Lastmod
33+
fetch-depth: 0
34+
- name: Setup Hugo
35+
uses: peaceiris/actions-hugo@v2
36+
with:
37+
hugo-version: ${{ env.WC_HUGO_VERSION }}
38+
extended: true
39+
- uses: actions/cache@v3
40+
with:
41+
path: /tmp/hugo_cache_runner/
42+
key: ${{ runner.os }}-hugomod-${{ hashFiles('**/go.mod') }}
43+
restore-keys: |
44+
${{ runner.os }}-hugomod-
45+
- name: Setup Pages
46+
id: pages
47+
uses: actions/configure-pages@v3
48+
- name: Build with Hugo
49+
env:
50+
HUGO_ENVIRONMENT: production
51+
run: |
52+
echo "Hugo Cache Dir: $(hugo config | grep cachedir)"
53+
hugo --minify --baseURL "${{ steps.pages.outputs.base_url }}/"
54+
- name: Upload artifact
55+
uses: actions/upload-pages-artifact@v2
56+
with:
57+
path: ./public
58+
59+
# Deploy website to GitHub Pages hosting
60+
deploy:
61+
if: github.repository_owner != 'HugoBlox'
62+
environment:
63+
name: github-pages
64+
url: ${{ steps.deployment.outputs.page_url }}
65+
runs-on: ubuntu-latest
66+
needs: build
67+
steps:
68+
- name: Deploy to GitHub Pages
69+
id: deployment
70+
uses: actions/deploy-pages@v2

.github/workflows/updater-wip.yml

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

0 commit comments

Comments
 (0)