Skip to content

Commit 530b333

Browse files
committed
Update workflow.
1 parent 072309c commit 530b333

File tree

2 files changed

+46
-13
lines changed

2 files changed

+46
-13
lines changed

.github/workflows/pypi.yml

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,33 @@
1-
name: Publish Python Package
1+
name: Publish to PyPI
22

33
on:
4-
release:
5-
types: [published]
4+
push:
5+
tags:
6+
- 'v*'
67

78
permissions:
89
contents: read
910

1011
jobs:
12+
1113
build-and-publish:
14+
name: Build and publish
1215
runs-on: ubuntu-latest
16+
environment: pypi
17+
permissions:
18+
id-token: write
1319
steps:
1420
- name: Check out source
15-
uses: actions/checkout@v3
16-
21+
uses: actions/checkout@v4
1722
- name: Set up Python
18-
uses: actions/setup-python@v4
23+
uses: actions/setup-python@v5
1924
with:
2025
python-version: '3.x'
21-
2226
- name: Install dependencies
2327
run: |
2428
python -m pip install --upgrade pip
2529
pip install build
26-
2730
- name: Build package
2831
run: python -m build
29-
3032
- name: Publish package
3133
uses: pypa/gh-action-pypi-publish@release/v1
32-
with:
33-
user: __token__
34-
password: ${{ secrets.PYPI_API_TOKEN }}
35-
skip-existing: true

.github/workflows/test-pypi.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Publish to Test PyPI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
13+
build-and-publish:
14+
name: Build and publish
15+
runs-on: ubuntu-latest
16+
environment: test-pypi
17+
steps:
18+
- name: Check out source
19+
uses: actions/checkout@v4
20+
- name: Set up Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: '3.x'
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install build
28+
- name: Build package
29+
run: python -m build
30+
- name: Publish package
31+
uses: pypa/gh-action-pypi-publish@release/v1
32+
with:
33+
repository-url: https://test.pypi.org/legacy/
34+
skip-existing: true
35+
verbose: true

0 commit comments

Comments
 (0)