Skip to content

Commit bba6141

Browse files
committed
ci: add manual workflow for TestPyPI publishing
1 parent 8c6b696 commit bba6141

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Publish to TestPyPI (Manual)
2+
3+
# Manual workflow to publish to TestPyPI for testing before production release
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
confirm:
8+
description: 'Type "publish" to confirm TestPyPI upload'
9+
required: true
10+
type: string
11+
12+
permissions:
13+
contents: read
14+
id-token: write
15+
16+
jobs:
17+
build_and_publish:
18+
name: Build and publish to TestPyPI
19+
runs-on: ubuntu-latest
20+
# Only run if user typed "publish" to confirm
21+
if: github.event.inputs.confirm == 'publish'
22+
environment: testpypi
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
28+
- name: Set up Python
29+
uses: actions/setup-python@v5
30+
with:
31+
python-version: "3.x"
32+
33+
- name: Install build tooling
34+
run: python -m pip install --upgrade pip build
35+
36+
- name: Build distributions
37+
run: python -m build --sdist --wheel
38+
39+
- name: Publish package distributions to TestPyPI
40+
uses: pypa/gh-action-pypi-publish@release/v1
41+
with:
42+
repository-url: https://test.pypi.org/legacy/
43+
skip-existing: true
44+
45+
- name: Output installation command
46+
run: |
47+
VERSION=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")
48+
echo "::notice::Package published to TestPyPI. Test with: pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple fmd_api==$VERSION"

0 commit comments

Comments
 (0)