From 373a535d62fb5cccf5ba29486a6fe96934d4a6c8 Mon Sep 17 00:00:00 2001 From: Alexandru Dan Duna Date: Thu, 16 Jul 2026 15:50:12 +0300 Subject: [PATCH 1/2] Modify semantic-release publish to use latest GitHub release tag reachable from current branch --- .github/workflows/python-package.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 3554c7e6..80e32ac7 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -93,10 +93,15 @@ jobs: TWINE_USERNAME: ${{secrets.REPOSITORY_USERNAME}} TWINE_PASSWORD: ${{secrets.PYPI_PASSWORD}} - name: Semantic release - Publish package distributions to GitHub Releases - # Only publish if Semantic release built packages under "dist/"; hashFiles returns '' when no files match the given pattern. + # Only publish if Semantic release built packages under "dist/"; hashFiles returns '' when no files match the given pattern. if: hashFiles('dist/*') != '' run: | - semantic-release publish + # Publish packages to the latest GitHub release reachable from the current branch. + # This is so that releases from maintenance branches (e.g. "1.6.x") don't upload + # packages to the latest release on the repo (default behavior of 'publish' when + # no tag is passed), which would likely be one that was published from master. + RELEASE_TAG="$(git describe --tags --abbrev=0)" + semantic-release publish --tag "$RELEASE_TAG" env: # To generate a new token use the following guide, providing access to the "repo" scope. # https://docs.github.com/en/enterprise-server@3.4/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token From f8403e1647df9853bacc08bdce0211ed89180e38 Mon Sep 17 00:00:00 2001 From: Alexandru Dan Duna Date: Thu, 16 Jul 2026 18:04:53 +0300 Subject: [PATCH 2/2] Improve comment --- .github/workflows/python-package.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 80e32ac7..abb040cf 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -98,8 +98,9 @@ jobs: run: | # Publish packages to the latest GitHub release reachable from the current branch. # This is so that releases from maintenance branches (e.g. "1.6.x") don't upload - # packages to the latest release on the repo (default behavior of 'publish' when - # no tag is passed), which would likely be one that was published from master. + # packages to the highest-versioned release on the repo (default behavior of + # 'publish' when no tag is passed), which would likely be one that was published + # from master. RELEASE_TAG="$(git describe --tags --abbrev=0)" semantic-release publish --tag "$RELEASE_TAG" env: