Skip to content

Commit f6e2dfb

Browse files
committed
actions: updating publish workflow
1 parent 4cbeca7 commit f6e2dfb

1 file changed

Lines changed: 37 additions & 16 deletions

File tree

Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,51 @@
1-
---
21
name: Upload Python Package
32

43
on:
54
release:
65
types: [created]
76
workflow_dispatch:
87

9-
jobs:
10-
deploy:
8+
permissions:
9+
contents: read
1110

11+
jobs:
12+
build:
1213
runs-on: ubuntu-latest
13-
1414
steps:
15-
- uses: actions/checkout@v2
15+
- uses: actions/checkout@v4
16+
1617
- name: Set up Python
17-
uses: actions/setup-python@v2
18+
uses: actions/setup-python@v5
1819
with:
19-
python-version: '3.9'
20-
- name: Install dependencies
20+
python-version: '3.10'
21+
22+
- name: Install build tooling
2123
run: |
2224
python -m pip install --upgrade pip
23-
pip install build wheel twine
24-
- name: Build and publish
25-
env:
26-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
27-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
28-
run: |
29-
python -m build
30-
twine upload dist/*
25+
python -m pip install build
26+
27+
- name: Build package
28+
run: python -m build
29+
30+
- name: Upload build artifacts
31+
uses: actions/upload-artifact@v4
32+
with:
33+
name: built-distributions
34+
path: dist/
35+
36+
upload:
37+
needs: build
38+
runs-on: ubuntu-latest
39+
environment: release
40+
permissions:
41+
id-token: write # required for PyPI Trusted Publishing (OIDC)
42+
contents: read
43+
steps:
44+
- name: Download build artifacts
45+
uses: actions/download-artifact@v4
46+
with:
47+
name: built-distributions
48+
path: dist/
49+
50+
- name: Publish package
51+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)