Skip to content

Commit

Permalink
Added repository option[testpypi, pypi], Added user info
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamedNasser8 committed Aug 31, 2024
1 parent f086836 commit f4e75c2
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ on:
- 'minor'
- 'patch'

repository:
description: 'Repository to publish to'
required: true
default: 'testpypi'
type: choice
options:
- 'pypi'
- 'testpypi'

jobs:
release:
runs-on: ubuntu-latest
Expand All @@ -37,6 +46,8 @@ jobs:
- name: Bump version
run: |
poetry run python handle_versioning.py ${{ github.event.inputs.version }}
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
git add pyproject.toml
git commit -m "Bump version to ${{ github.event.inputs.version }}"
git push
Expand All @@ -47,7 +58,15 @@ jobs:
git tag $current_version
git push origin $current_version
- name: Publish to PyPI
- name: Build package
run: |
poetry build
- name: Publish to TestPyPI or PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: ${{ github.event.inputs.repository == 'pypi' && 'https://upload.pypi.org/legacy/' || 'https://test.pypi.org/legacy/' }}
username: __token__
password: ${{ github.event.inputs.repository == 'pypi' && secrets.PYPI_API_TOKEN || secrets.TEST_PYPI_API_TOKEN }}
env:
POETRY_PYPI_TOKEN: ${{ secrets.POETRY_PYPI_TOKEN }}
run: poetry publish --build
POETRY_PYPI_TOKEN: ${{ github.event.inputs.repository == 'pypi' && secrets.PYPI_POETRY_TOKEN || secrets.TEST_PYPI_POETRY_TOKEN }}

0 comments on commit f4e75c2

Please sign in to comment.