Update changelog. #7
Workflow file for this run
This file contains hidden or 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: release | |
on: | |
push: | |
tags: [ 'v[1-9]+.*' ] | |
workflow_dispatch: | |
inputs: | |
which-pypi: | |
description: 'Which Python package index?' | |
required: true | |
type: choice | |
options: | |
- pypi | |
- testpypi | |
default: testpypi | |
env: | |
DISTRIBUTIONS_PATH: '.auxiliary/artifacts/hatch-build' | |
jobs: | |
initialize: | |
uses: ./.github/workflows/core--initializer.yaml | |
test: | |
needs: [initialize] | |
uses: emcd/python-project-common/.github/workflows/xrepo--tester.yaml@gha-1 | |
with: | |
matrix-exclusions: '${{ needs.initialize.outputs.matrix-exclusions }}' | |
platforms: '${{ needs.initialize.outputs.platforms }}' | |
python-descriptors: '${{ needs.initialize.outputs.python-descriptors }}' | |
python-versions: '${{ needs.initialize.outputs.python-versions }}' | |
report: | |
needs: [initialize, test] | |
uses: emcd/python-project-common/.github/workflows/xrepo--reporter.yaml@gha-1 | |
with: | |
python-version: '${{ fromJSON(needs.initialize.outputs.python-versions)[0] }}' | |
docsgen: | |
needs: [initialize, report] | |
permissions: | |
contents: write | |
id-token: write | |
pages: write | |
uses: emcd/python-project-common/.github/workflows/xrepo--documenter.yaml@gha-1 | |
with: | |
include-reports: true | |
python-version: '${{ fromJSON(needs.initialize.outputs.python-versions)[0] }}' | |
package: | |
needs: [initialize, docsgen] | |
uses: emcd/python-project-common/.github/workflows/xrepo--packager.yaml@gha-1 | |
with: | |
artifacts-path: '.auxiliary/artifacts/hatch-build' # TODO: Use environment. | |
python-version: '${{ fromJSON(needs.initialize.outputs.python-versions)[0] }}' | |
publish-pypi: | |
if: ${{ inputs.which-pypi == 'testpypi' || startsWith(github.ref, 'refs/tags/') }} | |
needs: [initialize, package] | |
runs-on: ubuntu-latest | |
environment: | |
name: ${{ inputs.which-pypi || 'pypi' }} | |
url: ${{ fromJSON(needs.initialize.outputs.pypi-package-urls)[inputs.which-pypi || 'pypi'] }}dynadoc | |
permissions: | |
id-token: write # Only needed for PyPI trusted publishing | |
steps: | |
- name: Restore Distributions | |
uses: actions/download-artifact@v4 | |
with: | |
name: python-package-distributions--${{ github.run_id }} | |
path: ${{ env.DISTRIBUTIONS_PATH }} | |
- name: Publish Distributions | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
packages-dir: ${{ env.DISTRIBUTIONS_PATH }} | |
repository-url: ${{ fromJSON(needs.initialize.outputs.pypi-api-urls)[inputs.which-pypi || 'pypi'] }} | |
print-hash: true | |
skip-existing: ${{ inputs.which-pypi == 'testpypi' }} | |
publish-github: | |
needs: | |
- initialize | |
- package | |
- publish-pypi | |
# --- BEGIN: Injected by Copier --- | |
# --- END: Injected by Copier --- | |
runs-on: ubuntu-latest | |
permissions: | |
attestations: write | |
contents: write | |
id-token: write | |
steps: | |
- name: Prepare Python | |
uses: emcd/python-project-common/.github/actions/python-hatch@gha-1 | |
with: | |
python-version: ${{ fromJSON(needs.initialize.outputs.python-versions)[0] }} | |
- name: Restore Distributions | |
uses: actions/download-artifact@v4 | |
with: | |
name: python-package-distributions--${{ github.run_id }} | |
path: ${{ env.DISTRIBUTIONS_PATH }} | |
- name: Generate Integrity Check Values | |
run: | | |
set -eu -o pipefail | |
cd ${{ env.DISTRIBUTIONS_PATH }} | |
sha256sum dynadoc-* >SHA256SUMS.txt | |
- name: Attest Build Provenance | |
uses: actions/attest-build-provenance@v2 | |
with: | |
subject-path: | | |
${{ env.DISTRIBUTIONS_PATH }}/SHA256SUMS.txt | |
${{ env.DISTRIBUTIONS_PATH }}/dynadoc-* | |
- name: Generate Release Notes | |
run: | | |
set -eu -o pipefail | |
hatch --env develop run \ | |
towncrier build --draft --version ${GITHUB_REF_NAME} \ | |
>.auxiliary/artifacts/tc-release-notes.rst | |
cp .auxiliary/artifacts/tc-release-notes.rst .auxiliary/artifacts/release-notes.rst | |
- name: Create Release | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
run: | | |
gh release create '${{ github.ref_name }}' \ | |
--repo '${{ github.repository }}' \ | |
--notes-file .auxiliary/artifacts/release-notes.rst | |
- name: Publish Artifacts | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
run: | | |
gh release upload '${{ github.ref_name }}' \ | |
${{ env.DISTRIBUTIONS_PATH }}/** \ | |
--repo '${{ github.repository }}' |