Skip to content

Commit

Permalink
update publish
Browse files Browse the repository at this point in the history
  • Loading branch information
emrgnt-cmplxty committed Sep 12, 2024
1 parent cd324d4 commit 009c930
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.10'

Expand All @@ -24,24 +24,30 @@ jobs:
run: pip install poetry

- name: Bump version for dev branches (TestPyPI)
if: github.event_name == 'push' # Only for pushes, not manual runs
if: github.event_name == 'push'
working-directory: ./py
run: |
version=$(poetry version -s)
new_version="${version}+$(date +'%Y%m%d%H%M')-$(git rev-parse --short HEAD)"
poetry version $new_version
- name: Build and publish to TestPyPI
if: github.event_name == 'push' # Publish to TestPyPI for automatic pushes
if: github.event_name == 'push'
working-directory: ./py
run: |
poetry config repositories.testpypi https://test.pypi.org/legacy/
poetry build
poetry config repositories.testpypi https://test.pypi.org/legacy
poetry publish -r testpypi --username __token__ --password ${{ secrets.TEST_PYPI_API_TOKEN }}
poetry config pypi-token.testpypi ${{ secrets.TEST_PYPI_API_TOKEN }}
poetry publish -r testpypi -vvv
env:
PYTHON_KEYRING_BACKEND: keyring.backends.null.Keyring

- name: Build and publish to PyPI
if: github.event_name == 'workflow_dispatch' # Publish to real PyPI only on manual trigger
if: github.event_name == 'workflow_dispatch'
working-directory: ./py
run: |
poetry build
poetry publish --username __token__ --password ${{ secrets.PYPI_API_TOKEN }}
poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}
poetry publish -vvv
env:
PYTHON_KEYRING_BACKEND: keyring.backends.null.Keyring

0 comments on commit 009c930

Please sign in to comment.