-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #222 from medema-group/chore/github-deploy
Chore/GitHub deploy
- Loading branch information
Showing
6 changed files
with
74 additions
and
8 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,27 @@ | ||
# from https://github.com/actinia-org/actinia-core/blob/main/.github/workflows/update-version.yml | ||
name: Update Version Number | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
update-version-number: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Update Version Number | ||
run: | | ||
OLD_VERSION=$(grep ^version pyproject.toml | cut -d '"' -f 2) | ||
OLD_VERSION="\"$OLD_VERSION\"" | ||
NEW_VERSION="\"$GITHUB_REF_NAME\"" | ||
sed -i "s+version = $OLD_VERSION+version = $NEW_VERSION+g" pyproject.toml | ||
- name: Commit Changes | ||
run: | | ||
git config user.name "$GITHUB_ACTOR" | ||
git config user.email "[email protected]" | ||
git commit -a -m "Update version number to new_version" | ||
git push origin HEAD:main |
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
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,30 @@ | ||
"""Module that contains helper functions specifically related to the bigscape version | ||
""" | ||
|
||
import toml | ||
|
||
from importlib import metadata | ||
from pathlib import Path | ||
|
||
|
||
def get_bigscape_version() -> str: | ||
"""Get the version of BiG-SCAPE. | ||
The way we retrieve the version is different depending on whether the package is | ||
installed or not. | ||
We need a dedicated library for this because the python community has not figured | ||
out that version numbers are pretty core to software development and there is no | ||
single place to put them. We want it to only be in the pyproject.toml file and not | ||
anywhere else, but this file is not available when installed as a package | ||
""" | ||
# can we get to the pyproject.toml file? | ||
print(__file__) | ||
pyproject_toml = Path(__file__).parent.parent.parent / "pyproject.toml" | ||
|
||
if pyproject_toml.exists(): | ||
return toml.load(pyproject_toml)["project"]["version"] | ||
|
||
# if not, we're probably running as a package. get the version of the currently | ||
# installed big-scape package | ||
|
||
return metadata.version("big-scape") |
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 |
---|---|---|
|
@@ -21,3 +21,4 @@ dependencies: | |
- pip: | ||
- click==8.1.7 | ||
- PyYAML==6.0.1 | ||
- importlib-metadata==8.5.0 |