-
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.
Merge pull request #4 from INTERSECT-SDK/publishing-versioning
add publish CD job and allow for prerelease versions
- Loading branch information
Showing
13 changed files
with
79 additions
and
21 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,33 @@ | ||
name: Release to PyPi | ||
|
||
on: | ||
push: | ||
tags: "v[0-9]+.[0-9]+.[0-9]+*" | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: write | ||
id-token: write | ||
|
||
jobs: | ||
build: | ||
if: startsWith(github.ref, 'refs/tags/') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup PDM | ||
uses: pdm-project/setup-pdm@v4 | ||
with: | ||
python-version: "3.8" | ||
cache: true | ||
- name: Publish package to PyPI | ||
env: | ||
PDM_PUBLISH_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | ||
run: pdm publish --username __token__ --repository pypi | ||
- name: upload to github release | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
files: | | ||
dist/* | ||
# assume any version with "a" (gets "ALPHA") or "b" (gets BETA) will be a prerelease | ||
prerelease: ${{ contains(github.ref, 'a') || contains(github.ref, 'b') }} |
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
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,18 @@ | ||
"""Version sanity checks to make sure that the release version is properly formatted.""" | ||
|
||
|
||
def strip_version_metadata(version: str) -> str: | ||
"""Given a string, do the following. | ||
1) Strip out pre-release/build-metadata from the string | ||
2) If the string is missing all of <MAJOR>.<MINOR>.<PATCH>, raise runtime error | ||
This is necessary because INTERSECT works off of a strict SemVer string and does not understand build metadata. | ||
""" | ||
import re | ||
|
||
sem_ver = re.search(r'\d+\.\d+\.\d+', version) | ||
if sem_ver is None: | ||
msg = 'Package version does not contain a semantic version "<MAJOR>.<MINOR>.<DEBUG>", please fix this' | ||
raise RuntimeError(msg) | ||
return sem_ver.group() |
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
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