Workflow file for this run
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
name: Publish Python π distributions π¦ to PyPI | |
on: | |
release: | |
types: [published] | |
jobs: | |
build-n-publish: | |
name: Build and publish Python π distributions π¦ to TestPyPI | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Install build dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install build | |
- name: Build package | |
run: python -m build | |
- name: Publish distribution π¦ to Test PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.test_pypi_password }} | |
repository-url: https://test.pypi.org/legacy/ | |
skip-existing: true | |
- name: Install from testpypi and import | |
shell: bash | |
run: | | |
sleep 5 | |
while [ "${{ github.ref_name }}" != $(pip index versions -i https://test.pypi.org/simple --pre exchange_calendars | cut -d'(' -f2 | cut -d')' -f1 | sed 1q) ];\ | |
do echo "waiting for package to appear in test index, sleeping 5s"; sleep 5s; echo "woken up"; done | |
pip install --index-url https://test.pypi.org/simple exchange_calendars==${{ github.ref_name }} --no-deps | |
pip install -r etc/requirements.txt | |
python -c 'import exchange_calendars;print(exchange_calendars.__version__)' | |
- name: Clean pip | |
run: | | |
pip uninstall -y exchange_calendars | |
pip cache purge | |
- name: Publish distribution π¦ to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.pypi_password }} | |
- name: Install and import | |
shell: bash | |
run: | | |
sleep 5 | |
while [ "${{ github.ref_name }}" != $(pip index versions -i https://pypi.org/simple --pre exchange_calendars | cut -d'(' -f2 | cut -d')' -f1 | sed 1q) ];\ | |
do echo "waiting for package to appear in index, sleeping 5s"; sleep 5s; echo "woken up"; done | |
pip install --index-url https://pypi.org/simple exchange_calendars==${{ github.ref_name }} | |
python -c 'import exchange_calendars;print(exchange_calendars.__version__)' |