Skip to content

Commit 230c814

Browse files
Update PyPI publish
1 parent 7b4c2dd commit 230c814

File tree

1 file changed

+34
-26
lines changed

1 file changed

+34
-26
lines changed

.github/workflows/publishing.yaml

Lines changed: 34 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,41 @@
11
name: Publishing
22

3-
on:
4-
push:
5-
tags:
6-
- '[0-9]+.[0-9]+.[0-9]+'
3+
on: push
74

85
jobs:
9-
pypi:
10-
name: Publish to PyPI
11-
strategy:
12-
fail-fast: false
13-
matrix:
14-
python-version:
15-
- '3.12'
16-
os:
17-
- ubuntu-latest
18-
runs-on: ${{ matrix.os }}
6+
build:
7+
name: Build
8+
runs-on: ubuntu-latest
9+
1910
steps:
20-
- name: Checkout repository
21-
uses: actions/checkout@v4
22-
- name: Setup python
23-
uses: actions/setup-python@v5
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-python@v5
2413
with:
25-
python-version: ${{ matrix.python-version }}
26-
- name: Setup environment
27-
run: pip install twine build packaging
28-
- name: Build project
14+
python-version: '3.12'
15+
- name: Install pypa/build
16+
run: pip install build
17+
- name: Build a binary wheel and a source tarball
2918
run: python -m build
30-
- name: Check dist
31-
run: twine check dist/*
32-
- name: Publish project
33-
run: twine upload --username __token__ --password ${{ secrets.PYPI_TOKEN }} dist/*
19+
- uses: actions/upload-artifact@v3
20+
with:
21+
name: python-package-distributions
22+
path: dist/
23+
24+
publish-to-pypi:
25+
name: Publish to PyPI
26+
if: startsWith(github.ref, 'refs/tags/')
27+
needs:
28+
- build
29+
runs-on: ubuntu-latest
30+
environment:
31+
name: pypi
32+
url: https://pypi.org/p/simyan
33+
permissions:
34+
id-token: write
35+
36+
steps:
37+
- uses: actions/download-artifact@v3
38+
with:
39+
name: python-package-distributions
40+
path: dist/
41+
- uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)