Skip to content

Commit

Permalink
update workflow (#160)
Browse files Browse the repository at this point in the history
Add a workflow to manually publish to pypi
  • Loading branch information
liu-jc authored Dec 4, 2024
1 parent fdcb656 commit cadebd8
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 2 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/pypi_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ jobs:
- 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}
# Extract version from tag
VERSION=${GITHUB_REF#refs/tags/} # removes refs/tags/
echo "Installing version: $VERSION"
pip install --index-url https://test.pypi.org/simple/ uni2ts==${VERSION}
python -c "import uni2ts; print(uni2ts.__version__)"
publish-prod:
Expand Down Expand Up @@ -90,5 +93,8 @@ jobs:
- name: Verify PyPI publication
run: |
sleep 60
pip install uni2ts==${GITHUB_REF#refs/tags/v}
# Extract version from tag
VERSION=${GITHUB_REF#refs/tags/} # removes refs/tags/
echo "Installing version: $VERSION"
pip install uni2ts==$VERSION
python -c "import uni2ts; print(uni2ts.__version__)"
51 changes: 51 additions & 0 deletions .github/workflows/pypi_publish_manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# This workflow will upload a Python Package using Twine to Test PyPi (Full release) when a workflow_dispatch event is triggered.

name: Manually Publish Package

on: workflow_dispatch

jobs:
publish:
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: Run package validators
run: |
twine check dist/*
# Test install from wheel
pip install dist/*.whl
python -c "import uni2ts; print(uni2ts.__version__)"
- 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
# Extract version from tag
VERSION=${GITHUB_REF#refs/tags/} # removes refs/tags/
echo "Installing version: $VERSION"
pip install uni2ts==$VERSION
python -c "import uni2ts; print(uni2ts.__version__)"

0 comments on commit cadebd8

Please sign in to comment.