-
Notifications
You must be signed in to change notification settings - Fork 4
69 lines (62 loc) · 2.16 KB
/
Copy pathrelease.yml
File metadata and controls
69 lines (62 loc) · 2.16 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
name: Release
# Publish on merge to main. python-semantic-release inspects the Conventional
# Commit messages since the last "v*" tag, decides the next version (or that no
# release is warranted), bumps pyproject.toml, tags, creates a GitHub Release,
# and we then upload the built artifacts to PyPI.
#
# The version-bump commit it pushes back to main contains "[skip ci]" so this
# workflow does not retrigger itself.
on:
push:
branches: [main]
# Never run two releases concurrently.
concurrency:
group: release
cancel-in-progress: false
jobs:
test:
name: Unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: "3.12"
- name: Install package + dev deps
# setup-uv already created .venv and set VIRTUAL_ENV.
run: uv pip install -e ".[dev]"
- name: Run unit tests
run: |
uv run pytest tests/ \
--ignore=tests/test_acceptance.py \
--ignore=tests/test_query.py \
-q
release:
name: Semantic Release
runs-on: ubuntu-latest
needs: test
# Guard against forks: only the canonical repo should publish.
if: github.repository == 'lightdash/python-sdk'
permissions:
contents: write # push the version bump/tag and create the GitHub Release
id-token: write # PyPI Trusted Publishing (OIDC)
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # semantic-release needs full history + tags
- name: Python Semantic Release
id: release
uses: python-semantic-release/python-semantic-release@v9
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to PyPI
if: steps.release.outputs.released == 'true'
uses: pypa/gh-action-pypi-publish@release/v1
- name: Upload artifacts to the GitHub Release
if: steps.release.outputs.released == 'true'
uses: python-semantic-release/publish-action@v9
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.release.outputs.tag }}