forked from duckdb/duckdb-python
-
Notifications
You must be signed in to change notification settings - Fork 0
112 lines (106 loc) · 3.45 KB
/
Copy pathcleanup_pypi.yml
File metadata and controls
112 lines (106 loc) · 3.45 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: Cleanup PyPI
on:
workflow_call:
inputs:
environment:
description: CI environment to run in (pypi-test or pypi-prod-nightly)
type: string
required: true
subcommand:
description: List or Delete
type: string
default: delete
verbosity:
description: Tool verbosity ("verbose" or "debug")
type: string
default: verbose
secrets:
PYPI_CLEANUP_OTP:
description: PyPI OTP
required: true
PYPI_CLEANUP_PASSWORD:
description: PyPI password
required: true
workflow_dispatch:
inputs:
subcommand:
description: List or Delete
type: choice
required: true
options:
- list
- delete
default: list
environment:
description: CI environment to run in
type: choice
required: true
options:
- pypi-prod-nightly
- pypi-test
verbosity:
description: Tool verbosity
type: choice
required: true
options:
- verbose
- debug
default: verbose
jobs:
cleanup_pypi:
name: Remove Nightlies from PyPI
runs-on: ubuntu-latest
environment:
name: ${{ inputs.environment }}
env:
PYPI_CLEANUP_PASSWORD: ${{secrets.PYPI_CLEANUP_PASSWORD}}
PYPI_CLEANUP_OTP: ${{secrets.PYPI_CLEANUP_OTP}}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- if: ${{ vars.PYPI_CLEANUP_USERNAME == '' }}
run: |
echo "Error: PYPI_CLEANUP_USERNAME is not set in CI environment '${{ inputs.environment }}'"
exit 1
- if: ${{ vars.PYPI_MAX_NIGHTLIES == '' }}
run: |
echo "Error: PYPI_MAX_NIGHTLIES is not set in CI environment '${{ inputs.environment }}'"
exit 1
- name: Install Astral UV
uses: astral-sh/setup-uv@v7
with:
version: "0.9.0"
- name: Install dependencies
run: uv sync --only-group pypi --no-install-project
- name: List Stale Packages on PyPI
if: inputs.subcommand == 'list'
env:
PYTHON_UNBUFFERED: 1
run: |
set -x
uv run --no-sync python -u -m duckdb_packaging.pypi_cleanup \
--${{ inputs.environment == 'pypi-prod-nightly' && 'prod' || 'test' }} \
--max-nightlies ${{ vars.PYPI_MAX_NIGHTLIES }} \
--${{ inputs.verbosity }} \
list 2>&1 | tee cleanup_output
- name: Delete Stale Packages from PyPI
if: inputs.subcommand == 'delete'
env:
PYTHON_UNBUFFERED: 1
run: |
set -x
uv run --no-sync python -u -m duckdb_packaging.pypi_cleanup \
--${{ inputs.environment == 'pypi-prod-nightly' && 'prod' || 'test' }} \
--max-nightlies ${{ vars.PYPI_MAX_NIGHTLIES }} \
--${{ inputs.verbosity }} \
delete --username "${{ vars.PYPI_CLEANUP_USERNAME }}" 2>&1 | tee cleanup_output
- name: PyPI Cleanup Summary
run : |
echo "## PyPI Cleanup Summary" >> $GITHUB_STEP_SUMMARY
echo "* Subcommand: ${{ inputs.subcommand }}" >> $GITHUB_STEP_SUMMARY
echo "* CI Environment: ${{ inputs.environment }}" >> $GITHUB_STEP_SUMMARY
echo "* Output:" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
cat cleanup_output >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY