Checkout head to be able to commit + action to move tag #14
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 files (documentation, autotools) | |
on: | |
push: | |
paths: [man.md, aclocal.m4, configure.ac] | |
workflow_dispatch: | |
workflow_call: | |
release: | |
types: [published] | |
jobs: | |
convert_via_pandoc: | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
- name: Set version number (when publishing) | |
if: startsWith(github.ref, 'ref/tags/v') | |
run: | | |
python3 ${{ github.workspace }}/.github/update_version.py --version ${{ github.ref_name }} | |
- uses: dorny/paths-filter@v2 | |
id: changes | |
with: | |
filters: | | |
man: | |
- 'man.md' | |
autotools: | |
- 'aclocal.m4' | |
- 'configure.ac' | |
- uses: docker://pandoc/core:3.3 | |
if: ${{ github.event_name == 'workflow_dispath' || steps.changes.outputs.man == 'true' }} | |
with: | |
args: -s man.md -t man -o shc.1 | |
- uses: docker://pandoc/core:3.3 | |
if: ${{ github.event_name == 'workflow_dispath' || steps.changes.outputs.man == 'true' }} | |
with: | |
args: -s man.md -t html -o man.html | |
- run: |- | |
./autogen.sh | |
if: ${{ github.event_name == 'workflow_dispath' || steps.changes.outputs.autotools == 'true' }} | |
- name: Commit changes | |
if: ${{ github.event_name == 'workflow_dispath' || steps.changes.outputs.man == 'true' || steps.changes.outputs.autotools }} | |
run: |- | |
for r in $(git remote) ; do git remote get-url --all $r ; done | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
git commit -a -m "ci: Github Action Generate Files" | |
git push | |
- name: Move tag on release | |
if: ${{ startsWith(github.ref, 'ref/tags/v') && ( ${{ github.event_name == 'workflow_dispath' || steps.changes.outputs.man == 'true' || steps.changes.outputs.autotools }} ) }} | |
git tag -fa "${{ github.ref_name }}" -m "Update ${{ github.ref_name }} tag" | |
git push origin "${{ github.ref_name }}" --force |