Test Publication Process #2
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 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 | |
- 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: 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/* |