Repository navigation
93 lines (82 loc) · 2.94 KB
/
Copy pathpython-publish.yml
File metadata and controls
93 lines (82 loc) · 2.94 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: Publish pyseekdb to PyPI
on:
push:
tags:
- 'v[0-9]*'
release:
types: [published]
workflow_dispatch:
inputs:
package_version:
description: Version to build for this run (blank uses pyproject.toml)
type: string
required: false
permissions:
contents: read
concurrency:
# Serialize the registry check and upload across release tags.
group: >-
${{ github.event_name == 'workflow_dispatch' && format('pyseekdb-pypi-check-{0}', github.ref) || 'pyseekdb-pypi-release' }}
queue: max
cancel-in-progress: false
jobs:
release-build:
runs-on: ubuntu-latest
outputs:
upload: ${{ steps.check.outputs.upload }}
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
persist-credentials: false
- uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5
with:
version: '0.9.22'
python-version: '3.11'
- name: Apply the requested build version
if: github.event_name == 'workflow_dispatch' && inputs.package_version != ''
env:
PACKAGE_VERSION: ${{ inputs.package_version }}
run: uv version --frozen -- "$PACKAGE_VERSION"
- name: Build the wheel and source distribution
run: |
export SOURCE_DATE_EPOCH=$(git show -s --format=%ct HEAD)
make build
- name: Validate distributions and release version
id: check
env:
RELEASE_TAG: >-
${{ github.ref_type == 'tag' &&
(github.event_name != 'workflow_dispatch' || inputs.package_version == '') &&
github.ref_name || '' }}
PUBLISH_TO_PYPI: ${{ github.repository == 'oceanbase/pyseekdb' && github.event_name != 'workflow_dispatch' }}
run: |
uv run --no-project --with twine python -m twine check --strict dist/*.whl dist/*.tar.gz
uv run --no-project --with packaging python .github/scripts/check-pypi-release.py
- name: Upload validated distributions
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: release-dists
path: |
dist/*.whl
dist/*.tar.gz
if-no-files-found: error
pypi-publish:
if: >-
github.repository == 'oceanbase/pyseekdb' &&
github.ref_type == 'tag' &&
github.event_name != 'workflow_dispatch' &&
needs.release-build.outputs.upload == 'true'
needs: release-build
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Retrieve validated distributions
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: release-dists
path: dist/
- name: Publish distributions with PyPI Trusted Publishing
uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # release/v1
with:
skip-existing: true