Skip to content

Commit e416ccc

Browse files
committed
Add release workflow
- The workflow does no release if a valid environment is not selected. - By default, the workflow will create a .devN release using the current uap-core master.
1 parent 4dcf29c commit e416ccc

File tree

2 files changed

+112
-0
lines changed

2 files changed

+112
-0
lines changed

.github/workflows/release.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Publish Python distribution to PyPI and TestPyPI
2+
3+
on:
4+
schedule:
5+
# schedule a dev release on every 1st of the month, at 2034 UTC
6+
- cron: "34 20 1 * *"
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: "uap-core ref to release"
11+
type: string
12+
environment:
13+
description: "environment to release for (testpypy or pypy)"
14+
type: environment
15+
16+
jobs:
17+
build:
18+
name: Build distribution
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
with:
24+
submodules: true
25+
fetch-depth: 0
26+
- name: update core
27+
# needs to detach because we can update to a tag
28+
run: git -C uap-core switch --detach ${{ inputs.tag || 'master' }}
29+
- name: Set up Python
30+
uses: actions/setup-python@v5
31+
with:
32+
python-version: "3.x"
33+
34+
- name: Install pypa/build
35+
run: python3 -m pip install build --user
36+
- name: Build a binary wheel and a source tarball
37+
run: python3 -m build -w ua-parser-builtins
38+
- run: mv ua-parser-builtins/dist .
39+
- name: Store the distribution packages
40+
uses: actions/upload-artifact@v4
41+
with:
42+
name: python-package-distributions
43+
path: dist/
44+
45+
publish-to-testpypi:
46+
name: Publish to TestPyPI
47+
if: ${{ github.event.inputs.environment == 'testpypi' }}
48+
needs:
49+
- build
50+
runs-on: ubuntu-latest
51+
52+
environment:
53+
name: testpypi
54+
url: https://test.pypi.org/p/ua-parser-builtins
55+
56+
permissions:
57+
id-token: write
58+
59+
steps:
60+
- name: Download all the dists
61+
uses: actions/download-artifact@v4
62+
with:
63+
name: python-package-distributions
64+
path: dist/
65+
- name: Publish
66+
uses: pypa/gh-action-pypi-publish@release/v1
67+
with:
68+
repository-url: https://test.pypi.org/legacy/
69+
70+
publish-to-pypi:
71+
name: publish
72+
if: ${{ github.event_name == 'schedule' || github.event.inputs.environment == 'pypi' }}
73+
needs:
74+
- build
75+
runs-on: ubuntu-latest
76+
environment:
77+
name: pypi
78+
url: https://pypi.org/p/ua-parser-builtins
79+
permissions:
80+
id-token: write
81+
82+
steps:
83+
- name: Download all the dists
84+
uses: actions/download-artifact@v4
85+
with:
86+
name: python-package-distributions
87+
path: dist/
88+
- name: Publish
89+
uses: pypa/gh-action-pypi-publish@release/v1

ua-parser-builtins/pyproject.toml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,32 @@ name = "ua-parser-builtins"
77
description = "Precompiled rules for User Agent Parser"
88
readme = "README.md"
99
dependencies = ["ua-parser"]
10+
requires-python = ">=3.9"
1011
license = {text = "Apache 2.0"}
1112
urls = {repository = "https://github.com/ua-parser/uap-python"}
1213
dynamic = ["version"]
14+
maintainers = [
15+
{ name = "masklinn", email = "[email protected]" }
16+
]
17+
18+
classifiers = [
19+
"Development Status :: 4 - Beta",
20+
"Environment :: Web Environment",
21+
"Intended Audience :: Developers",
22+
"Operating System :: OS Independent",
23+
"License :: OSI Approved :: Apache Software License",
24+
"Programming Language :: Python",
25+
"Topic :: Internet :: WWW/HTTP",
26+
"Topic :: Software Development :: Libraries :: Python Modules",
27+
"Programming Language :: Python :: 3",
28+
"Programming Language :: Python :: 3.9",
29+
"Programming Language :: Python :: 3.10",
30+
"Programming Language :: Python :: 3.11",
31+
"Programming Language :: Python :: 3.12",
32+
"Programming Language :: Python :: Implementation :: CPython",
33+
"Programming Language :: Python :: Implementation :: PyPy",
34+
# "Programming Language :: Python :: Implementation :: GraalPy",
35+
]
1336

1437
[tool.hatch.build.hooks.custom]
1538

0 commit comments

Comments
 (0)