From 44eef4b90ab5ea831d20e5d5e52554e683e7bba1 Mon Sep 17 00:00:00 2001 From: d33bs Date: Mon, 30 Dec 2024 16:25:06 -0700 Subject: [PATCH 1/3] add pypi trusted publishing workflow --- .github/workflows/publish-pypi.yml | 37 ++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/publish-pypi.yml diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml new file mode 100644 index 0000000..9f6a5d9 --- /dev/null +++ b/.github/workflows/publish-pypi.yml @@ -0,0 +1,37 @@ +--- +# used for publishing packages to pypi on release +name: publish pypi release + +on: + release: + types: + - published + +jobs: + publish_pypi: + runs-on: ubuntu-latest + environment: release + permissions: + # IMPORTANT: this permission is mandatory for trusted publishing + id-token: write + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Fetch tags + run: git fetch --all --tags + - name: Python setup + uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Setup for poetry + run: | + python -m pip install poetry + poetry self add "poetry-dynamic-versioning[plugin]" + - name: Install environment + run: poetry install --no-interaction --no-ansi + - name: poetry build distribution content + run: poetry build + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 \ No newline at end of file From a7096595aae91a95ea81e3e965a111920f353b85 Mon Sep 17 00:00:00 2001 From: d33bs Date: Mon, 30 Dec 2024 16:28:09 -0700 Subject: [PATCH 2/3] add docs for release process --- CONTRIBUTING.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6d608d4..a04b1f4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -72,8 +72,6 @@ Specifically, there are several ways to suggest or make changes to this reposito 1. Open a GitHub issue: https://github.com/manubot/manubot-ai-editor/issues 1. Create a pull request from a forked branch of the repository -### Creating a pull request - ### Pull requests After you’ve decided to contribute code and have written it up, please file a pull request. @@ -92,3 +90,17 @@ Pull request review and approval is required by at least one project maintainer We will do our best to review the code addition in a timely fashion. Ensuring that you follow all steps above will increase our speed and ability to review. We will check for accuracy, style, code coverage, and scope. + +#### Release publishing process + +Several manual and automated steps are involved with publishing `manubot-ai-editor` releases. +See below for an overview of how this works. + +Notes about [semantic version](https://en.wikipedia.org/wiki/Software_versioning#Semantic_versioning) (semver) specifications: +`manubot-ai-editor` version specifications are controlled through [`poetry-dynamic-versioning`](https://github.com/mtkennerly/poetry-dynamic-versioning) which leverages [`dunamai`](https://github.com/mtkennerly/dunamai) to create version data based on [git tags](https://git-scm.com/book/en/v2/Git-Basics-Tagging) and commits. +`manubot-ai-editor` release git tags are automatically applied through [GitHub Releases](https://docs.github.com/en/repositories/releasing-projects-on-github/about-releases) and related inferred changes from [`release-drafter`](https://github.com/release-drafter/release-drafter). + +1. Open a pull request and use a repository label for `release-` to label the pull request for visibility with [`release-drafter`](https://github.com/release-drafter/release-drafter). On merging the pull request for the release, a [GitHub Actions workflow](https://docs.github.com/en/actions/using-workflows) defined in `draft-release.yml` leveraging [`release-drafter`](https://github.com/release-drafter/release-drafter) will draft a release for maintainers. +1. The draft GitHub release will include a version tag based on the GitHub PR label applied and `release-drafter`. +1. Make modifications as necessary to the draft GitHub release, then publish the release (the draft release does not normally need additional modifications). +1. On publishing the release, another GitHub Actions workflow defined in `publish-pypi.yml` will run to build and deploy the Python package to PyPI (utilizing the earlier modified `pyproject.toml` semantic version reference for labeling the release). From 93f00e4d06bb8dd47badd65e2a5e41e692814ddb Mon Sep 17 00:00:00 2001 From: d33bs Date: Thu, 16 Jan 2025 08:43:11 -0700 Subject: [PATCH 3/3] add pypi release step to docs --- CONTRIBUTING.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b248608..85ad930 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -120,3 +120,4 @@ manubot-ai-editor release git tags are automatically applied through [GitHub Rel 1. On merging the pull request for the release, a [GitHub Actions workflow](https://docs.github.com/en/actions/using-workflows) defined in `draft-release.yml` leveraging [`release-drafter`](https://github.com/release-drafter/release-drafter) will draft a release for maintainers. 1. The draft GitHub release will include a version tag based on the GitHub PR label applied and `release-drafter`. 1. Make modifications as necessary to the draft GitHub release, then publish the release (the draft release does not require additional modifications by default). +1. On publishing the GitHub release, another GitHub Actions workflow defined in `publish-pypi.yml` will run to build and deploy the Python package to PyPI (utilizing the earlier modified `pyproject.toml` semantic version reference for labeling the release). \ No newline at end of file