-
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.
- Loading branch information
Showing
5 changed files
with
30 additions
and
112 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,61 +1,17 @@ | ||
name: Release | ||
|
||
name: Publish to PyPI.org | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
types: [published] | ||
jobs: | ||
pypi: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
|
||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: conda-incubator/setup-miniconda@v2 | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
miniconda-version: "latest" | ||
mamba-version: "1.*" | ||
environment-file: conda/dev.yaml | ||
channels: conda-forge,nodefaults | ||
channel-priority: true | ||
activate-environment: comodi | ||
use-mamba: true | ||
miniforge-variant: Mambaforge | ||
|
||
- name: Install deps | ||
run: poetry install | ||
|
||
- name: Run semantic release (for tests) | ||
if: ${{ github.event_name != 'workflow_dispatch' }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: make release-dry | ||
|
||
- name: Release command | ||
if: ${{ github.event_name == 'workflow_dispatch' }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} | ||
run: | | ||
poetry config pypi-token.pypi ${PYPI_TOKEN} | ||
make release-ci | ||
- name: Generate documentation with changes from semantic-release | ||
if: ${{ github.event_name == 'workflow_dispatch' }} | ||
run: make docs-build | ||
|
||
- name: GitHub Pages action | ||
if: ${{ github.event_name == 'workflow_dispatch' }} | ||
uses: peaceiris/[email protected] | ||
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: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./docs/_build/html | ||
password: ${{ secrets.PYPI_API_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 |
---|---|---|
|
@@ -19,16 +19,13 @@ | |
from .tools import hierarchical_priors | ||
|
||
|
||
def _get_version() -> str: | ||
"""Return the program version.""" | ||
try: | ||
return importlib_metadata.version(__name__) | ||
except importlib_metadata.PackageNotFoundError: # pragma: no cover | ||
return "0.1.0" # Default version | ||
|
||
|
||
version: str = _get_version() | ||
|
||
__author__ = "Jonas Dehning" | ||
__email__ = "[email protected]" | ||
__version__: str = version | ||
|
||
from importlib.metadata import version, PackageNotFoundError | ||
|
||
try: | ||
__version__ = version("package-name") | ||
except PackageNotFoundError: | ||
# package is not installed | ||
pass |
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