-
-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(semantic-release): add semantic release to the project (#114)
* feat(semantic-release): add semantic release to the project * Add test release to workflow * fix typo * Fix HEAD branch name * Force node version to 18 on release.yaml * fix poetry on ci according to python-poetry/poetry#4210 * Adding back dbf to fix tests * Skipping sids dbc test
- Loading branch information
Showing
11 changed files
with
176 additions
and
13 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
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,49 @@ | ||
name: release | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: conda-incubator/setup-miniconda@v2 | ||
with: | ||
miniconda-version: "latest" | ||
mamba-version: "*" | ||
environment-file: conda/dev.yaml | ||
channels: conda-forge,nodefaults | ||
activate-environment: env-pysus | ||
use-mamba: true | ||
miniforge-variant: Mambaforge | ||
|
||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
|
||
- name: Test release | ||
if: ${{ github.event_name != 'workflow_dispatch' }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: make release-dry | ||
|
||
- name: Release | ||
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 | ||
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,8 +21,8 @@ pyvenv.cfg | |
*.ipynb_checkpoints* | ||
*.dbc | ||
*.DBC | ||
*.dbf | ||
*.DBF | ||
# *.dbf | ||
# *.DBF | ||
*.pickle | ||
*.parquet | ||
|
||
|
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,80 @@ | ||
{ | ||
"branches": ["main"], | ||
"tagFormat": "${version}", | ||
"plugins": [ | ||
[ | ||
"@semantic-release/commit-analyzer", { | ||
"preset": "conventionalcommits" | ||
}], | ||
[ | ||
"@google/semantic-release-replace-plugin", | ||
{ | ||
"replacements": [ | ||
{ | ||
"files": ["pysus/__init__.py"], | ||
"from": "return \".*\" # changed by semantic-release", | ||
"to": "return \"${nextRelease.version}\" # changed by semantic-release", | ||
"results": [ | ||
{ | ||
"file": "pysus/__init__.py", | ||
"hasChanged": true, | ||
"numMatches": 1, | ||
"numReplacements": 1 | ||
} | ||
], | ||
"countMatches": true | ||
}, | ||
{ | ||
"files": ["pyproject.toml"], | ||
"from": "version = \".*\" # changed by semantic-release", | ||
"to": "version = \"${nextRelease.version}\" # changed by semantic-release", | ||
"results": [ | ||
{ | ||
"file": "pyproject.toml", | ||
"hasChanged": true, | ||
"numMatches": 1, | ||
"numReplacements": 1 | ||
} | ||
], | ||
"countMatches": true | ||
} | ||
] | ||
} | ||
], | ||
[ | ||
"@semantic-release/release-notes-generator", { | ||
"preset": "conventionalcommits" | ||
}], | ||
[ | ||
"@semantic-release/changelog", | ||
{ | ||
"changelogTitle": "Release Notes\n---", | ||
"changelogFile": "CHANGELOG.md" | ||
} | ||
], | ||
[ | ||
"@semantic-release/exec", | ||
{ | ||
"prepareCmd": "poetry build", | ||
"publishCmd": "poetry publish" | ||
} | ||
], | ||
[ | ||
"@semantic-release/github", | ||
{ | ||
"assets": ["dist/*.whl", "dist/*.tar.gz"] | ||
} | ||
], | ||
[ | ||
"@semantic-release/git", | ||
{ | ||
"assets": [ | ||
"pyproject.toml", | ||
"CHANGELOG.md", | ||
"pysus/__init__.py" | ||
], | ||
"message": "chore(release): ${nextRelease.version}" | ||
} | ||
] | ||
] | ||
} |
Empty file.
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 |
---|---|---|
@@ -1 +1,16 @@ | ||
# type: ignore[attr-defined] | ||
"""PySUS Python package""" | ||
|
||
from . import preprocessing, utilities | ||
from importlib import metadata as importlib_metadata | ||
|
||
|
||
def get_version() -> str: | ||
try: | ||
return importlib_metadata.version(__name__) | ||
except importlib_metadata.PackageNotFoundError: # pragma: no cover | ||
return "0.6.4" # changed by semantic-release | ||
|
||
|
||
version: str = get_version() | ||
__version__: str = version |
Binary file not shown.
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