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