-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workflows for automatically publishing packages to PyPi.
- Loading branch information
Showing
3 changed files
with
150 additions
and
0 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,95 @@ | ||
# This workflow will upload a Python Package to Pypi using Twine when a release is created in this Github repo. | ||
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries | ||
# Note: There is a bug in Github Actions, so do NOT use the “Save Draft” functionality when creating a new release: https://github.community/t/workflow-set-for-on-release-not-triggering-not-showing-up/16286/5 | ||
# Remember to always verify tagged releases are actually available on the Pypi website: https://pypi.org/project/autogluon/ | ||
|
||
name: Publish Package | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
validate-publish-test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.10' | ||
|
||
- name: Install tools | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install hatch twine check-wheel-contents | ||
- name: Build package | ||
run: | | ||
hatch build | ||
- name: Run package validators | ||
run: | | ||
twine check dist/* | ||
check-wheel-contents dist/*.whl | ||
# Test install from wheel | ||
pip install dist/*.whl | ||
python -c "import uni2ts; print(uni2ts.__version__)" | ||
# Test install from sdist | ||
# pip uninstall -y uni2ts | ||
# pip install dist/*.tar.gz | ||
# python -c "import uni2ts; print(uni2ts.__version__)" | ||
- name: Upload to Test PyPI | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }} | ||
TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/ | ||
run: | | ||
twine upload --verbose dist/* | ||
- name: Verify Test PyPI publication | ||
run: | | ||
sleep 60 | ||
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ uni2ts==${GITHUB_REF#refs/tags/v} | ||
python -c "import uni2ts; print(uni2ts.__version__)" | ||
publish-prod: | ||
needs: validate-publish-test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.10' | ||
|
||
- name: Install tools | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install hatch twine | ||
- name: Build package | ||
run: | | ||
hatch build | ||
- name: Upload to PyPI | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | ||
run: | | ||
twine upload --verbose dist/* | ||
- name: Verify PyPI publication | ||
run: | | ||
sleep 60 | ||
pip install uni2ts==${GITHUB_REF#refs/tags/v} | ||
python -c "import uni2ts; print(uni2ts.__version__)" |
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,52 @@ | ||
# This workflow will upload a Python Package using Twine to Test PyPi (Full release) when a workflow_dispatch event is triggered. | ||
# THIS IS MEANT AS A FINAL SANITY CHECK BEFORE RELEASE. | ||
|
||
name: Test Publication Process | ||
|
||
on: workflow_dispatch | ||
|
||
jobs: | ||
validate: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.10' | ||
|
||
- name: Modify version for test | ||
run: | | ||
VERSION=$(python -c "exec(open('src/uni2ts/__about__.py').read()); print(__version__)") | ||
echo "__version__ = \"${VERSION}.dev$(date +%Y%m%d)\"" > src/uni2ts/__about__.py | ||
cat src/uni2ts/__about__.py | ||
- name: Install tools | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install hatch twine check-wheel-contents | ||
- name: Build package | ||
run: | | ||
hatch build | ||
- name: Run package validators | ||
run: | | ||
twine check dist/* | ||
check-wheel-contents dist/*.whl | ||
# Test install from wheel | ||
pip install dist/*.whl | ||
python -c "import uni2ts; print(uni2ts.__version__)" | ||
- name: Test publish to Test PyPI | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }} | ||
TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/ | ||
run: | | ||
twine upload --verbose dist/* |
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 |
---|---|---|
|
@@ -29,6 +29,9 @@ requires-python = ">=3.10" | |
authors = [ | ||
{name = "Gerald Woo", email = "[email protected]"}, | ||
{name = "Chenghao Liu", email = "[email protected]"}, | ||
{name = "Juncheng Liu", email = "[email protected]"}, | ||
{name = "Taha Aksu", email = "[email protected]"}, | ||
{name = "Xu Liu", email = "[email protected]"}, | ||
{name = "Akshat Kumar"}, | ||
{name = "Caiming Xiong"}, | ||
{name = "Silvio Savarese"}, | ||
|