Skip to content

Commit

Permalink
Experiment with trusted publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
loicteixeira committed May 8, 2023
1 parent 83fb02a commit e1c00a1
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
47 changes: 47 additions & 0 deletions .github/workflows/publish-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Publish to PyPI-Test
on:
push:
tags:
# Only run for tags ending with `.devN`
# https://peps.python.org/pep-0440/#summary-of-permitted-suffixes-and-relative-ordering
- '*\.dev\d+'
jobs:
tests:
uses: ./.github/workflows/tests.yml

build:
needs: ['tests']
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v3
with:
python-version: 3.11

- run: |
pip install setuptools
python setup.py sdist
- uses: actions/upload-artifact@v3
with:
path: ./dist

# https://docs.pypi.org/trusted-publishers/using-a-publisher/
pypi-test-publish:
needs: ['build']
environment: 'publish'

name: upload release to PyPI-Test
runs-on: ubuntu-latest
permissions:
# Mandatory for trusted publishing
id-token: write
steps:
- uses: actions/download-artifact@v3

- name: Publish package distributions to PyPI-Test
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages_dir: artifact/
repository-url: https://test.pypi.org/legacy/
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ on:
push:
branches:
- main

pull_request:
workflow_call: # Allow for the publish workflows to run the tests by calling this workflow

jobs:
test:
Expand Down

0 comments on commit e1c00a1

Please sign in to comment.