Skip to content

Commit e91c74d

Browse files
Merge pull request #252 from simonsobs/koopman/trusted-publisher
Set up PyPI trusted publisher
2 parents dee0525 + 49f1d39 commit e91c74d

1 file changed

Lines changed: 27 additions & 10 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,17 @@ on:
1010

1111
jobs:
1212
test:
13+
name: Run tests
1314
uses: ./.github/workflows/pytest.yml
1415
secrets: inherit
1516

1617
wheel:
17-
name: build and deploy to PyPI
18+
name: Build wheel
1819
needs: test
1920
runs-on: ubuntu-latest
20-
env:
21-
TWINE_USERNAME: __token__
22-
TWINE_PASSWORD: ${{ secrets.TWINE_TOKEN }}
2321

2422
steps:
25-
- name: Set up Python 3.10
23+
- name: set up Python 3.10
2624
uses: actions/setup-python@v6
2725
with:
2826
python-version: '3.10'
@@ -32,7 +30,7 @@ jobs:
3230

3331
- name: install build dependencies
3432
run: |
35-
python3 -m pip install --upgrade build twine
33+
python3 -m pip install --upgrade build
3634
3735
- name: build wheel
3836
run: |
@@ -48,11 +46,30 @@ jobs:
4846
run: |
4947
python3 -m pip install ${{ steps.find.outputs.wheel }}[dev]
5048
51-
- name: Run unit tests
49+
- name: run unit tests
5250
working-directory: ./tests
5351
run: |
5452
python3 -m pytest
5553
56-
- name: upload to PyPI
57-
run: |
58-
python3 -m twine upload dist/*
54+
- name: upload dist
55+
uses: actions/upload-artifact@v6
56+
with:
57+
path: ./dist/
58+
59+
pypi-publish:
60+
name: Upload release to PyPI
61+
needs: wheel
62+
runs-on: ubuntu-latest
63+
environment:
64+
name: pypi
65+
url: https://pypi.org/p/sorunlib
66+
permissions:
67+
id-token: write # required for trusted publishing
68+
steps:
69+
- name: download dist
70+
uses: actions/download-artifact@v5
71+
with:
72+
path: dist
73+
74+
- name: publish package distributions to PyPI
75+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)