diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml new file mode 100644 index 00000000..21b3c03e --- /dev/null +++ b/.github/workflows/create-release.yml @@ -0,0 +1,55 @@ +name: Create release + +on: + push: + tags: + - "v*" + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +env: + FORCE_COLOR: "1" + UV_SYSTEM_PYTHON: "1" # make uv do global installs + +jobs: + publish-pypi: + runs-on: ubuntu-latest + name: PyPI Release + environment: release + if: github.repository_owner == 'breathe-doc' + permissions: + id-token: write # for PyPI trusted publishing + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3" + + - name: Install uv + uses: astral-sh/setup-uv@v5 + with: + version: latest + enable-cache: false + + - name: Install build dependencies (pypa/build, twine) + run: uv pip install build "twine>=5.1" + + - name: Build distribution + run: python -m build + + - name: Check distribution + run: | + twine check --strict dist/* + + - name: Upload to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/README.rst b/README.rst index 66ab5e45..e98ca023 100644 --- a/README.rst +++ b/README.rst @@ -128,13 +128,11 @@ Examples of projects that use Breathe: Release ------- -See the ``mkrelease`` utility in the root of the repository. - -Useful vim command for changelog conversion to the git tag format: - -.. code:: vim - - %s/\v`(#[0-9]+) \<[^`]*`__/\1/g +1. Update `CHANGELOG.rst` and create the git tag (`vX.Y.Z`). +2. Push the tag to GitHub. +3. The `create-release.yml` workflow will publish the release to PyPI. +4. Go to https://github.com/breathe-doc/breathe/tags, select the new tag, + and click the "Create release from tag" button to publish a GitHub release. Maintainers ----------- diff --git a/mkrelease b/mkrelease deleted file mode 100755 index 2aab9cc9..00000000 --- a/mkrelease +++ /dev/null @@ -1,122 +0,0 @@ -#!/bin/sh - -set -eu - -hash cd -hash git -hash gpg -hash mkdir -hash printf -hash python3 -hash rm -hash tar -hash twine - -# Melvin Vermeeren -PGP_KEY='8AED 5802 1FEA CDD5 F27B A0E6 A72F 6277 16EA 9D96' - -REPO_WWW='https://github.com/breathe-doc/breathe/' - -help() -{ - printf 'Usage: %s pack\n' "$0" - printf 'Usage: %s sign\n' "$0" - printf 'Usage: %s upload\n' "$0" - printf 'Usage: %s clean\n' "$0" - return 0 -} - -pack() -( - mkdir -- mkrelease_tmp - - git archive \ - --format=tar.gz \ - --prefix="breathe-$version/" \ - -o "mkrelease_tmp/breathe-$version.tar.gz" \ - -- "v$version" \ - - cd -- mkrelease_tmp - tar -xf "breathe-$version.tar.gz" - - cd -- "breathe-$version" - python3 -m build - mv -- dist .. - - cd -- .. - rm -r -- "breathe-$version" - - exit 0 -) - -sign() -( - cd -- mkrelease_tmp - - gpg -bu "$PGP_KEY" -- "breathe-$version.tar.gz" - - for file in dist/*; do - gpg -bau "$PGP_KEY" -- "$file" - done - - exit 0 -) - -upload() -( - cd -- mkrelease_tmp - - twine check --strict dist/* - twine upload -- dist/* - - { - printf 'Note: Source tarball signature must be uploaded manually.\n' - printf '\tCreate a new release on GitHub for version: %s\n' "$version" - printf '\tThe source tarball itself must not be uploaded.\n' - printf '\t%s\n' "$REPO_WWW/releases/new?tag=v$version" - } >&2 - - exit 0 -) - -clean() -( - if [ -d mkrelease_tmp ]; then - rm -r -- mkrelease_tmp - fi - - exit 0 -) - -if [ "$#" -eq 0 ]; then - help >&2 - exit 1 -fi - -if [ ! -d .git ]; then - printf 'Error: Not executed from repository root\n' >&2 - exit 1 -fi - -if ! version="$(git describe --tags --exact)"; then - printf 'Error: Cannot retrieve version from git.\n' >&2 - exit 1 -fi -version="${version#v}" - -command="$1" - -case "$command" in -pack|sign|upload|clean) - "$command" - ;; -*) - { - printf 'Error: Unknown command: %s\n' "$command" - printf '\n' - help - } >&2 - exit 1 -esac - -exit 0