Publish on tag or [Release] commit

This commit is contained in:
object-Object 2023-08-28 02:05:42 -04:00
parent 23801f9ef9
commit 9540fba6db

View file

@ -7,7 +7,7 @@ on:
publish:
description: Whether to publish the docgen to PyPI.
type: boolean
default: false
required: true
segment:
description: The version segment to bump with Hatch.
type: string
@ -36,19 +36,18 @@ jobs:
- name: Install docgen
run: pip install . hatch
- name: Bump version
if: inputs.segment
run: hatch version ${{ inputs.segment }}
- name: Commit updated version
if: inputs.segment
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Bump version from ${{ github.ref }}
- name: Generate web book
run: hexdoc doc/properties.toml --ci -o out
- name: Bump version
if: github.event_name == 'workflow_dispatch' && inputs.segment
run: hatch version ${{ inputs.segment }}
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Build web book from ${{ github.ref }}
- name: Build docgen
run: hatch build
@ -96,7 +95,10 @@ jobs:
publish:
runs-on: ubuntu-latest
needs: build
if: inputs.publish == true
if: |-
inputs.publish == true ||
startsWith(github.ref, 'refs/tags') ||
startsWith(github.event.head_commit.message, '[Release]')
environment:
name: testpypi