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

Use trusted published for PyPI #40

Merged
merged 8 commits into from
Feb 9, 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
34 changes: 26 additions & 8 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ on:
- "*"

jobs:
build_and_publish:
name: Build and publish
build:
name: Test and build
runs-on: ubuntu-latest
steps:
- name: Checkout 🔁
Expand All @@ -30,10 +30,28 @@ jobs:
- name: Run tests 🌈
run: poetry run invoke test

- name: Build the package 📦
run: poetry build

- name: Publish build artifact ⬆️
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 #v4.3.1
with:
name: package-dist
path: dist
publish:
name: Publish
needs: build
runs-on: ubuntu-latest
environment: PyPI
permissions:
# this permission is mandatory for trusted publishing
id-token: write
steps:
- name: Download build artifact ⬇️
uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe #v4.1.2
with:
name: package-dist
path: dist

- name: Publish package to PyPI 🙌
run: |
set -e
poetry config http-basic.pypi "__token__" "${PYPI_TOKEN}"
poetry publish --build
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
uses: pypa/gh-action-pypi-publish@2f6f737ca5f74c637829c0f5c3acd0e29ea5e8bf #v1.8.11
Loading
Loading