| 1 | name: Generate man pages |
| 2 | on: |
| 3 | push: |
| 4 | branches: |
| 5 | - '**' |
| 6 | paths: |
| 7 | - '**.ronn' |
| 8 | - '**/ronn.yml' |
| 9 | permissions: |
| 10 | contents: read |
| 11 | jobs: |
| 12 | ronn: |
| 13 | name: Ronn |
| 14 | runs-on: ubuntu-latest |
| 15 | steps: |
| 16 | - uses: actions/checkout@v7 |
| 17 | with: |
| 18 | persist-credentials: false |
| 19 | - uses: geomys/[email protected] |
| 20 | with: |
| 21 | persist-workspace-changes: true |
| 22 | run: | |
| 23 | sudo apt-get update && sudo apt-get install -y ronn |
| 24 | bash -O globstar -c 'ronn **/*.ronn' |
| 25 | # rdiscount randomizes the output for no good reason, which causes |
| 26 | # changes to always get committed. Sigh. |
| 27 | # https://github.com/davidfstr/rdiscount/blob/6b1471ec3/ext/generate.c#L781-L795 |
| 28 | for f in doc/*.html; do |
| 29 | awk '/Filippo Valsorda/ { $0 = "<p>Filippo Valsorda <a href=\"mailto:[email protected]\" data-bare-link=\"true\">[email protected]</a></p>" } { print }' "$f" > "$f.tmp" |
| 30 | mv "$f.tmp" "$f" |
| 31 | done |
| 32 | - uses: actions/upload-artifact@v7 |
| 33 | with: |
| 34 | name: man-pages |
| 35 | path: | |
| 36 | doc/*.1 |
| 37 | doc/*.html |
| 38 | commit: |
| 39 | name: Commit changes |
| 40 | needs: ronn |
| 41 | permissions: |
| 42 | contents: write |
| 43 | runs-on: ubuntu-latest |
| 44 | steps: |
| 45 | - uses: actions/checkout@v7 |
| 46 | with: |
| 47 | persist-credentials: true |
| 48 | - uses: actions/download-artifact@v8 |
| 49 | with: |
| 50 | name: man-pages |
| 51 | path: doc/ |
| 52 | - name: Commit and push if changed |
| 53 | run: |- |
| 54 | git config user.name "GitHub Actions" |
| 55 | git config user.email "[email protected]" |
| 56 | git add doc/ |
| 57 | git commit -m "doc: regenerate groff and html man pages" || exit 0 |
| 58 | git push |