Publish to PYPI #4
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 to PYPI | |
on: | |
release: | |
types: [ published ] | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [3.11] | |
poetry-version: [1.5.1] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install poetry ${{ matrix.poetry-version }} | |
run: | | |
python -m ensurepip | |
python -m pip install --upgrade pip | |
python -m pip install poetry==${{ matrix.poetry-version }} | |
- name: View poetry --help | |
run: poetry --help | |
- name: Install dependencies | |
shell: bash | |
run: python -m poetry install | |
- name: Test with pytest | |
run: | | |
python -m poetry run python -m pytest -v tests | |
publish: | |
needs: build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [3.11] | |
poetry-version: [1.5.1] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install poetry ${{ matrix.poetry-version }} | |
run: | | |
python -m ensurepip | |
python -m pip install --upgrade pip | |
python -m pip install poetry==${{ matrix.poetry-version }} | |
- name: Install dependencies | |
shell: bash | |
run: python -m poetry install | |
- name: Publish to test PyPi package | |
env: | |
PYPI_TOKEN: ${{ secrets.TEST_PYPI_TOKEN }} | |
run: | | |
python -m poetry config repositories.testpypi https://test.pypi.org/legacy/ | |
python -m poetry config http-basic.testpypi __token__ $PYPI_TOKEN | |
python -m poetry publish --build | |
# - name: Publish to PyPi package | |
# env: | |
# PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} | |
# run: | | |
# python -m poetry config http-basic.pypi __token__ $PYPI_TOKEN | |
# python -m poetry publish --build | |