Skip to content

Commit c727d9b

Browse files
committed
Add release workflow for ua-parser
Also update the release workflow for the builtins: - configure `run-name` to print the inputs (otherwise they're not printed anywhere and it's hard to check them) - make the publish action `verbose` - don't fail testpypi on duplicates (easier to test workflow files)
1 parent f2434ba commit c727d9b

File tree

2 files changed

+56
-1
lines changed

2 files changed

+56
-1
lines changed

.github/workflows/release.yml renamed to .github/workflows/release-builtins.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
name: Publish Python distribution to PyPI and TestPyPI
1+
name: Publish ua-parser builtins
2+
3+
run-name: Publish ${{ inputs.tag || 'master' }} to ${{ inputs.environment || 'dummy' }}
24

35
on:
46
schedule:
@@ -67,6 +69,8 @@ jobs:
6769
uses: pypa/gh-action-pypi-publish@release/v1
6870
with:
6971
repository-url: https://test.pypi.org/legacy/
72+
skip-existing: true
73+
verbose: true
7074

7175
publish-to-pypi:
7276
name: publish
@@ -88,3 +92,5 @@ jobs:
8892
path: dist/
8993
- name: Publish
9094
uses: pypa/gh-action-pypi-publish@release/v1
95+
with:
96+
verbose: true

.github/workflows/release-main.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Publish ua-parser
2+
3+
on:
4+
workflow_dispatch:
5+
release:
6+
types: [created]
7+
8+
env:
9+
ENVNAME: ${{ github.event_name == 'release' && 'pypi' || 'testpypi' }}
10+
ENVURL: https://${{ github.event_name != 'release' && 'test.' || '' }}pypy.org/p/ua-parser
11+
12+
jobs:
13+
release:
14+
runs-on: ubuntu-latest
15+
16+
environment:
17+
name: ${{ github.event_name == 'release' && 'pypi' || 'testpypi' }}
18+
url: https://${{ github.event_name != 'release' && 'test.' || '' }}pypy.org/p/ua-parser
19+
20+
permissions:
21+
id-token: write
22+
23+
steps:
24+
- name: Checkout working copy
25+
uses: actions/checkout@v4
26+
- name: Set up Python
27+
uses: actions/setup-python@v5
28+
with:
29+
python-version: "3.x"
30+
- name: Install dependency
31+
run: |
32+
python -mpip install --upgrade pip
33+
python -mpip install build
34+
- name: Build sdist and wheel
35+
run: python -mbuild
36+
- name: Publish to testpypi
37+
if: ${{ env.ENVNAME == 'testpypi' }}
38+
uses: pypa/gh-action-pypi-publish@release/v1
39+
with:
40+
repository-url: https://test.pypi.org/legacy/
41+
skip-existing: true
42+
verbose: true
43+
password: ${{ secrets.PUBLISH_TOKEN }}
44+
- name: Publish to pypi
45+
if: ${{ env.ENVNAME == 'pypi' }}
46+
uses: pypa/gh-action-pypi-publish@release/v1
47+
with:
48+
verbose: true
49+
password: ${{ secrets.PUBLISH_TOKEN }}

0 commit comments

Comments
 (0)