Skip to content

Commit

Permalink
separate pypi and testpypi jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
alphasentaurii committed Apr 3, 2024
1 parent 3759fb6 commit f73ef36
Showing 1 changed file with 33 additions and 19 deletions.
52 changes: 33 additions & 19 deletions .github/workflows/publish_to_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,38 +36,52 @@ jobs:
shell: 'bash'
run: python -m build --sdist --wheel .

- uses: actions/upload-artifact@v3.1.2
- uses: actions/upload-artifact@v4
with:
path: dist/*

publish_testpypi:
needs: [ build_artifacts ]
runs-on: ubuntu-latest
permissions:
id-token: write
if: ${{ inputs.test }}
steps:
- uses: actions/download-artifact@v4
with:
name: artifact
path: dist

- name: Publish package distributions to TEST PyPI
uses: pypa/[email protected]
with:
name: testpypi
user: ${{ secrets.PYPI_USERNAME_SPACEKIT_MAINTAINER }}
password: ${{ secrets.PYPI_PASSWORD_SPACEKIT_MAINTAINER_TEST }}
repository-url: https://test.pypi.org/legacy/
verify-metadata: true
skip-existing: false
verbose: true

publish_pypi:
needs: [ build_artifacts ]
runs-on: ubuntu-latest
env:
name: pypi
url: https://pypi.org/project/spacekit
user: ${{ secrets.PYPI_USERNAME_SPACEKIT_MAINTAINER }}
password: ${{ secrets.PYPI_PASSWORD_SPACEKIT_MAINTAINER }}
test_password: ${{ secrets.PYPI_PASSWORD_SPACEKIT_MAINTAINER_TEST }}
test_url: https://test.pypi.org/legacy/
verify_metadata: true
skip_existing: false
verbose: true
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
if: ${{ inputs.test == 'false' }}
steps:
# retrieve your distributions here
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v4
with:
name: artifact
path: dist

- name: Publish package distributions to PyPI
uses: pypa/[email protected]
with:
user: ${{ env.user }}
password: ${{ (inputs.test == 'true' && env.test_password) || env.password }}
repository-url: ${{ (inputs.test == 'true' && env.test_url) || env.url }}
verify-metadata: ${{ env.verify_metadata }}
skip-existing: ${{ env.skip_existing }}
verbose: ${{ env.verbose }}
name: pypi
user: ${{ secrets.PYPI_USERNAME_SPACEKIT_MAINTAINER }}
password: ${{ secrets.PYPI_PASSWORD_SPACEKIT_MAINTAINER }}
repository-url: https://pypi.org/p/spacekit
verify-metadata: true
skip-existing: false
verbose: false

0 comments on commit f73ef36

Please sign in to comment.