122 lines
3 KiB
YAML
122 lines
3 KiB
YAML
name: Build the web book
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- docgen-2-1.20 # TODO: remove
|
|
workflow_dispatch:
|
|
inputs:
|
|
branch:
|
|
description: Branch to generate docs from
|
|
type: choice
|
|
options:
|
|
- (same as workflow)
|
|
- 0.10.3-docs
|
|
- 0.9.5-docs
|
|
release:
|
|
description: Release this version
|
|
type: boolean
|
|
default: false
|
|
update-latest:
|
|
description: Overwrite latest (and root, if releasing)
|
|
type: boolean
|
|
default: true
|
|
publish:
|
|
description: Package index to publish to
|
|
type: choice
|
|
options:
|
|
- none
|
|
- PyPI (release)
|
|
- TestPyPI
|
|
segment:
|
|
description: Version segment to bump with Hatch
|
|
type: string
|
|
required: false
|
|
|
|
env:
|
|
PYPI_PACKAGE: hexdoc
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: hexdoc
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
hexdoc:
|
|
uses: ./.github/workflows/hexdoc.yml
|
|
permissions:
|
|
contents: write
|
|
pages: read
|
|
with:
|
|
python-version: "3.11"
|
|
checkout: ${{ github.event_name == 'workflow_dispatch' && inputs.branch != '(same as workflow)' }}
|
|
branch: ${{ inputs.branch }}
|
|
publish-latest-and-root: |-
|
|
${{
|
|
github.event_name != 'workflow_dispatch'
|
|
|| inputs.update-latest
|
|
}}
|
|
publish-release: |-
|
|
${{
|
|
github.event_name == 'workflow_dispatch' && inputs.release
|
|
|| startsWith(github.event.head_commit.message, '[Release]')
|
|
}}
|
|
bump-version-segment: ${{ inputs.segment }}
|
|
|
|
publish-pypi:
|
|
runs-on: ubuntu-latest
|
|
needs: [hexdoc]
|
|
if: |-
|
|
needs.hexdoc.outputs.publish-release == 'true' &&
|
|
(github.event_name != 'workflow_dispatch' || inputs.publish == 'PyPI (release)')
|
|
|
|
environment:
|
|
name: pypi
|
|
url: https://pypi.org/p/${{ env.PYPI_PACKAGE }}
|
|
permissions:
|
|
id-token: write
|
|
contents: write
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Download package artifact
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: hexdoc-build
|
|
path: dist
|
|
|
|
- name: Publish to PyPI
|
|
uses: pypa/gh-action-pypi-publish@release/v1
|
|
|
|
- name: Create or update tag
|
|
uses: EndBug/latest-tag@v1
|
|
with:
|
|
# TODO: dynamically set this from somewhere instead of being hardcoded
|
|
ref: hexdoc-v1
|
|
|
|
publish-testpypi:
|
|
runs-on: ubuntu-latest
|
|
needs: [hexdoc]
|
|
if: github.event_name == 'workflow_dispatch' && inputs.publish == 'TestPyPI'
|
|
|
|
environment:
|
|
name: testpypi
|
|
url: https://test.pypi.org/p/${{ env.PYPI_PACKAGE }}
|
|
permissions:
|
|
id-token: write
|
|
|
|
steps:
|
|
- name: Download package artifact
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: hexdoc-build
|
|
path: dist
|
|
|
|
- name: Publish to TestPyPI
|
|
uses: pypa/gh-action-pypi-publish@release/v1
|
|
with:
|
|
repository-url: https://test.pypi.org/legacy/
|