Skip to content

Commit f77d06b

Browse files
authored
Merge pull request #88 from keboola/uv
Simplify workflows and enable dual PyPI publishing
2 parents fa07342 + 4f76275 commit f77d06b

2 files changed

Lines changed: 50 additions & 32 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 12 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,10 @@ name: Build & Deploy to PyPI
33
on:
44
workflow_dispatch:
55
inputs:
6-
environment:
7-
description: Deployment environment
8-
required: true
9-
type: choice
10-
options:
11-
- test
12-
- production
6+
note:
7+
description: 'This workflow publishes to TestPyPI only. For production, create a GitHub Release.'
8+
required: false
9+
default: ""
1310

1411
release:
1512
types: [published]
@@ -51,36 +48,19 @@ jobs:
5148
echo "Tag version: $TAG_VERSION"
5249
uv version $TAG_VERSION
5350
54-
- name: Generate HTML documentation 📚
55-
if: github.event_name == 'release' || inputs.environment == 'production'
56-
run: |
57-
uv sync --all-groups --frozen
58-
uv pip install -e .
59-
uv run pdoc --html -f -o ./docs keboola.component
60-
mv ./docs/keboola/component/* docs
61-
rm -r ./docs/keboola
62-
6351
- name: Build package 📦
6452
run: |
6553
uv build
6654
67-
- name: Publish to PyPI 🚀
55+
- name: Publish to TestPyPI 🧪
6856
env:
69-
UV_PUBLISH_TOKEN: ${{ inputs.environment == 'test' && secrets.UV_PUBLISH_TOKEN_TEST_PYPI || secrets.UV_PUBLISH_TOKEN }}
57+
UV_PUBLISH_TOKEN: ${{ secrets.UV_PUBLISH_TOKEN_TEST_PYPI }}
7058
run: |
71-
uv publish ${{ inputs.environment == 'test' && '--index testpypi' || '' }}
59+
uv publish --index testpypi
7260
73-
- name: Commit documentation 📝
74-
if: github.event_name == 'release' || inputs.environment == 'production'
61+
- name: Publish to PyPI 🚀
62+
if: github.event_name == 'release'
63+
env:
64+
UV_PUBLISH_TOKEN: ${{ secrets.UV_PUBLISH_TOKEN }}
7565
run: |
76-
TAG_VERSION=${GITHUB_REF#refs/tags/}
77-
78-
# Checkout main before docs commit to avoid detached HEAD push failure
79-
git fetch origin main
80-
git checkout main
81-
82-
git config --global user.name 'KCF'
83-
git config --global user.email 'kcf@users.noreply.github.com'
84-
git add docs
85-
git commit -m "docs: update for release $TAG_VERSION 📚" || echo "No changes to commit"
86-
git push origin main
66+
uv publish
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Generate Documentation
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
generate-docs:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout 🛒
11+
uses: actions/checkout@v4
12+
13+
- name: Install uv 💜
14+
uses: astral-sh/setup-uv@v6
15+
16+
- name: Set up Python 🐍
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: "3.13"
20+
21+
- name: Install dependencies 📦
22+
run: |
23+
uv sync --all-groups --frozen
24+
25+
- name: Generate HTML documentation 📚
26+
run: |
27+
uv pip install -e .
28+
uv run pdoc --html -f -o ./docs keboola.component
29+
mv ./docs/keboola/component/* docs
30+
rm -r ./docs/keboola
31+
32+
- name: Commit documentation 📝
33+
run: |
34+
git config --global user.name 'KCF'
35+
git config --global user.email 'kcf@users.noreply.github.com'
36+
git add docs
37+
git commit -m "docs: update documentation 📚" || echo "No changes to commit"
38+
git push

0 commit comments

Comments
 (0)