-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Check whether version in PR is already released (#12)
We have a recurring issue that you often forget to bump the package version number in a PR, and then when you merge it to `master`, the package publication fails because the version you're trying to publish already exists. This adds a check to CI which detects these issues early and fails the CI, so you can't merge those PRs without bumping the package version number. Same as apify/apify-sdk-python#127.
- Loading branch information
Showing
6 changed files
with
63 additions
and
14 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Check package version availability | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
check_version_availability: | ||
name: Check version availability | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.8" | ||
|
||
- name: Install dependencies | ||
run: make install-dev | ||
|
||
- name: Check version availability | ||
run: make check-version-availability |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env python3 | ||
from utils import get_current_package_version, get_published_package_versions | ||
|
||
# Checks whether the current package version number was not already used in a published release. | ||
if __name__ == '__main__': | ||
current_version = get_current_package_version() | ||
|
||
# Load the version numbers of the currently published versions from PyPI | ||
published_versions = get_published_package_versions() | ||
|
||
# We don't want to try to publish a version with the same version number as an already released stable version | ||
if current_version in published_versions: | ||
raise RuntimeError(f'The current version {current_version} was already released!') |
This file contains 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
This file contains 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