Skip to content

Commit 3e6e4c1

Browse files
committed
builtins release workflow
1 parent 1388762 commit 3e6e4c1

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

.github/workflows/release.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Publish Python distribution to PyPI and TestPyPI
2+
3+
on:
4+
pull_request:
5+
types: ["synchronize"]
6+
7+
jobs:
8+
build:
9+
name: Build distribution
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
submodules: true
16+
fetch-depth: 0
17+
- name: Set up Python
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: "3.x"
21+
22+
- name: Install pypa/build
23+
run: python3 -m pip install build --user
24+
- name: Build a binary wheel and a source tarball
25+
run: python3 -m build ua-parser-builtins
26+
- run: mv ua/parser-builtins/dist .
27+
- name: Store the distribution packages
28+
uses: actions/upload-artifact@v4
29+
with:
30+
name: python-package-distributions
31+
path: dist/
32+
33+
publish-to-testpypi:
34+
name: Publish to TestPyPI
35+
needs:
36+
- build
37+
runs-on: ubuntu-latest
38+
39+
environment:
40+
name: testpypi
41+
url: https://test.pypi.org/p/ua-parser-builtins
42+
43+
permissions:
44+
id-token: write
45+
46+
steps:
47+
- name: Download all the dists
48+
uses: actions/download-artifact@v4
49+
with:
50+
name: python-package-distributions
51+
path: dist/
52+
- name: Publish
53+
uses: pypa/gh-action-pypi-publish@release/v1
54+
with:
55+
repository-url: https://test.pypi.org/legacy/
56+
57+
publish-to-pypi:
58+
name: publish
59+
if: false
60+
needs:
61+
- build
62+
runs-on: ubuntu-latest
63+
environment:
64+
name: pypi
65+
url: https://pypi.org/p/ua-parser-builtins
66+
permissions:
67+
id-token: write
68+
69+
steps:
70+
- name: Download all the dists
71+
uses: actions/download-artifact@v4
72+
with:
73+
name: python-package-distributions
74+
path: dist/
75+
- name: Publish
76+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)