-
Notifications
You must be signed in to change notification settings - Fork 2
81 lines (67 loc) · 2.22 KB
/
deploy.yml
File metadata and controls
81 lines (67 loc) · 2.22 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
name: Build & Deploy to PyPI
on:
workflow_dispatch:
inputs:
environment:
description: Deployment environment
required: true
type: choice
options:
- test
- production
release:
types: [published]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛒
uses: actions/checkout@v4
- name: Install uv 💜
uses: astral-sh/setup-uv@v6
- name: Install and run ruff 🐶
uses: astral-sh/ruff-action@v3
- name: Set up Python 🐍
uses: actions/setup-python@v4
with:
python-version: "3.13"
- name: Install dependencies 📦
run: |
uv sync --all-groups --frozen
- name: Lint with flake8 ❄️
run: |
uv run flake8
- name: Test with pytest ✅
run: |
uv run pytest tests
- name: Version replacement based on tag ↔️
if: github.ref_type == 'tag'
run: |
TAG_VERSION=${GITHUB_REF#refs/tags/}
echo "Tag version: $TAG_VERSION"
uv version $TAG_VERSION
- name: Generate HTML documentation 📚
if: github.event_name == 'release' || inputs.environment == 'production'
run: |
uv sync --all-groups --frozen
uv pip install -e .
uv run pdoc --html -f -o ./docs keboola.component
mv ./docs/keboola/component/* docs
rm -r ./docs/keboola
- name: Build package 📦
run: |
uv build
- name: Publish to PyPI 🚀
env:
UV_PUBLISH_TOKEN: ${{ inputs.environment == 'test' && secrets.UV_PUBLISH_TOKEN_TEST_PYPI || secrets.UV_PUBLISH_TOKEN }}
run: |
uv publish ${{ inputs.environment == 'test' && '--index testpypi' || '' }}
- name: Commit documentation 📝
if: github.event_name == 'release' || inputs.environment == 'production'
run: |
TAG_VERSION=${GITHUB_REF#refs/tags/}
git config --global user.name 'KCF'
git config --global user.email 'kcf@users.noreply.github.com'
git add docs
git commit -m "docs: update for release $TAG_VERSION 📚" || echo "No changes to commit"
git push