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

Switch to PyPI Trusted Publishing, remove twine #614

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
30 changes: 14 additions & 16 deletions .github/workflows/release_drafter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,16 @@ jobs:
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

deploy:
# This will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
#
# This job will run when you have tagged a commit, starting with "v*"
# or created a release in GitHub which includes a tag starting with "v*"
# and requires that you have put your twine API key in your
# github secrets (see readme for details)
pypi-publish:
# Uploads the new release to PyPI using Trusted Publishing
needs: [update_release_draft]
runs-on: ubuntu-latest
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
environment:
name: pypi
url: https://pypi.org/p/<your-pypi-project-name>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This URL needs to be fixed before this PR is merged.
I assume that <your-pypi-project-name> is micro-sam? Can someone confirm?

if: contains(github.ref, 'tags')
steps:
- uses: actions/checkout@v4
Expand All @@ -78,11 +78,9 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python -m build
twine upload dist/*
python -m pip install build
- name: Build micro-sam python package
run: python -m build
- name: Publish package distributions to PyPI
# This action uploads everything from the dist/ folder to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
3 changes: 1 addition & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ pytest
pytest-cov
pytest-qt
snakeviz
tabulate
twine
tabulate
Loading