Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: use trusted publisher to publish pypi package. #137

Merged
merged 3 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ jobs:
publish-pypi-package:
runs-on: [ubuntu-latest]
needs: release-please
environment:
name: pypi
url: https://pypi.org/p/cellxgene-ontology-guide
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
if: contains(needs.release-please.outputs.paths_released, 'api/python')
steps:
- name: Checkout main branch
Expand All @@ -72,10 +77,10 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: build and publish
# TODO change to make publish
- name: build
run: |
make test/publish -C api/python
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TESTPYPI_TOKEN_BENTO007 }}
make build -C api/python
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: api/python/dist
5 changes: 3 additions & 2 deletions api/python/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ build: package-data
pip install build twine
python -m build

test/publish: build
release/testpypi: build
python -m twine upload --repository testpypi dist/*

publish: build
release/pypi: build
# Manually release in case CI/CD pipeline is not working in ./.github/workflows/release.yml
python -m twine upload dist/*

unit-tests:
Expand Down
Loading