Skip to content

Commit 5f9fb20

Browse files
committed
Add publish.yml for release automation
1 parent 9240868 commit 5f9fb20

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

.github/workflows/publish.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Python Package Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*' # run on new version tags
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- uses: actions/setup-python@v5
16+
with:
17+
python-version: 3.11
18+
19+
- name: Install build backend
20+
run: python -m pip install --upgrade pip build
21+
22+
- name: Build sdist and wheel
23+
run: python -m build
24+
25+
- uses: actions/upload-artifact@v4
26+
with:
27+
name: dist
28+
path: dist/
29+
30+
publish-testpypi:
31+
needs: build
32+
runs-on: ubuntu-latest
33+
environment:
34+
name: testpypi
35+
url: https://test.pypi.org/project/transformer-ranker/
36+
permissions:
37+
id-token: write
38+
39+
steps:
40+
- uses: actions/download-artifact@v4
41+
with:
42+
name: dist
43+
path: dist/
44+
45+
- name: Upload to TestPyPI
46+
uses: pypa/gh-action-pypi-publish@release/v1
47+
with:
48+
repository-url: https://test.pypi.org/legacy/
49+
50+
publish-pypi:
51+
needs: build
52+
runs-on: ubuntu-latest
53+
environment:
54+
name: pypi
55+
url: https://pypi.org/project/transformer-ranker/
56+
permissions:
57+
id-token: write
58+
59+
steps:
60+
- uses: actions/download-artifact@v4
61+
with:
62+
name: dist
63+
path: dist/
64+
65+
- name: Upload to PyPI
66+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)