.github/workflows: update artifacts Actions #45
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate man pages | |
on: | |
push: | |
branches: | |
- '**' | |
paths: | |
- '**.ronn' | |
- '**/ronn.yml' | |
permissions: | |
contents: read | |
jobs: | |
ronn: | |
name: Ronn | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install ronn | |
run: sudo apt-get update && sudo apt-get install -y ronn | |
- name: Run ronn | |
run: bash -O globstar -c 'ronn **/*.ronn' | |
- name: Undo email mangling | |
# rdiscount randomizes the output for no good reason, which causes | |
# changes to always get committed. Sigh. | |
# https://github.com/davidfstr/rdiscount/blob/6b1471ec3/ext/generate.c#L781-L795 | |
run: |- | |
for f in doc/*.html; do | |
awk '/Filippo Valsorda/ { $0 = "<p>Filippo Valsorda <a href=\"mailto:[email protected]\" data-bare-link=\"true\">[email protected]</a></p>" } { print }' "$f" > "$f.tmp" | |
mv "$f.tmp" "$f" | |
done | |
- name: Upload generated files | |
uses: actions/upload-artifact@v4 | |
with: | |
name: man-pages | |
path: | | |
doc/*.1 | |
doc/*.html | |
commit: | |
name: Commit changes | |
needs: ronn | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download generated files | |
uses: actions/download-artifact@v4 | |
with: | |
name: man-pages | |
path: doc/ | |
- name: Commit and push if changed | |
run: |- | |
git config user.name "GitHub Actions" | |
git config user.email "[email protected]" | |
git add doc/ | |
git commit -m "doc: regenerate groff and html man pages" || exit 0 | |
git push |