-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cd4ad80
commit 98b722f
Showing
5 changed files
with
78 additions
and
43 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,48 @@ | ||
#!/usr/bin/env python3 | ||
import json | ||
import subprocess | ||
|
||
|
||
def get_last_version() -> str: | ||
"""Return the version number of the last release.""" | ||
json_string = ( | ||
subprocess.run( | ||
["gh", "release", "view", "--json", "tagName"], | ||
check=True, | ||
stdout=subprocess.PIPE, | ||
stderr=subprocess.PIPE, | ||
) | ||
.stdout.decode("utf8") | ||
.strip() | ||
) | ||
|
||
return json.loads(json_string)["tagName"] | ||
|
||
|
||
def bump_patch_number(version_number: str) -> str: | ||
"""Return a copy of `version_number` with the patch number incremented.""" | ||
major, minor, patch = version_number.split(".") | ||
return f"{major}.{minor}.{int(patch) + 1}" | ||
|
||
|
||
def create_new_patch_release(): | ||
"""Create a new patch release on GitHub.""" | ||
try: | ||
last_version_number = get_last_version() | ||
except subprocess.CalledProcessError as err: | ||
if err.stderr.decode("utf8").startswith("HTTP 404:"): | ||
# The project doesn't have any releases yet. | ||
new_version_number = "0.0.1" | ||
else: | ||
raise | ||
else: | ||
new_version_number = bump_patch_number(last_version_number) | ||
|
||
subprocess.run( | ||
["gh", "release", "create", "--generate-notes", new_version_number], | ||
check=True, | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
create_new_patch_release() |
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,17 @@ | ||
name: Publish to PyPI.org | ||
on: | ||
release: | ||
types: [published] | ||
jobs: | ||
pypi: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- run: python3 -m pip install --upgrade build && python3 -m build | ||
- name: Publish package | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.PYPI_API_TOKEN }} |
This file was deleted.
Oops, something went wrong.
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,12 @@ | ||
name: Create a new patch release | ||
on: workflow_dispatch | ||
jobs: | ||
github: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Create new patch release | ||
run: .github/scripts/release.py | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} |
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 |
---|---|---|
@@ -1,15 +1,12 @@ | ||
[build-system] | ||
requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.2"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[tool.setuptools_scm] | ||
|
||
|
||
[project] | ||
name = "WarrenCowleyParameters" | ||
# version = "2023.1" | ||
dynamic = ["version"] | ||
[tool.setuptools_scm] | ||
version_file = "WarrenCowleyParameters/_version.py" | ||
description = "OVITO Python modifier to compute Warren-Cowley parameters." | ||
keywords = ["ovito", "python-modifier"] | ||
authors = [{name = "Killian Sheriff", email = "[email protected]"}] | ||
|