Skip to content

Commit 1c26e06

Browse files
authored
Merge pull request #4 from hotdata-dev/ci/publish-on-version-tags
Publish to PyPI on version tag push
2 parents 798077b + b8682e1 commit 1c26e06

2 files changed

Lines changed: 71 additions & 4 deletions

File tree

.github/workflows/publish.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v[0-9]*'
7+
8+
concurrency:
9+
group: pypi-publish-${{ github.ref_name }}
10+
cancel-in-progress: false
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
build:
17+
name: Build distribution
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
21+
22+
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
23+
with:
24+
python-version: '3.12'
25+
26+
- name: Install build tooling
27+
run: python -m pip install --upgrade build twine
28+
29+
- name: Verify tag matches pyproject version
30+
run: |
31+
# Release tags must start with `v` followed by a PEP 440 version (e.g. v1.2.3, v1.2.3a1).
32+
if [[ ! "$GITHUB_REF_NAME" =~ ^v[0-9] ]]; then
33+
echo "Release tag '$GITHUB_REF_NAME' must start with 'v' followed by a digit (e.g. v1.0.0)" >&2
34+
exit 1
35+
fi
36+
tag="${GITHUB_REF_NAME#v}"
37+
pkg_version=$(python -c "import tomllib,pathlib; print(tomllib.loads(pathlib.Path('pyproject.toml').read_text())['project']['version'])")
38+
if [ "$tag" != "$pkg_version" ]; then
39+
echo "Release tag ($tag) does not match pyproject.toml version ($pkg_version)" >&2
40+
exit 1
41+
fi
42+
43+
- name: Build sdist and wheel
44+
run: python -m build
45+
46+
- name: Check distribution metadata
47+
run: python -m twine check --strict dist/*
48+
49+
- uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5
50+
with:
51+
name: dist
52+
path: dist/
53+
54+
publish:
55+
name: Publish to PyPI
56+
needs: build
57+
runs-on: ubuntu-latest
58+
environment:
59+
name: pypi
60+
url: https://pypi.org/p/hotdata-marimo
61+
permissions:
62+
id-token: write
63+
steps:
64+
- uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5
65+
with:
66+
name: dist
67+
path: dist/
68+
69+
- name: Publish via Trusted Publishing
70+
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0

pyproject.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
requires = ["hatchling"]
33
build-backend = "hatchling.build"
44

5-
[tool.hatch.metadata]
6-
allow-direct-references = true
7-
85
[project]
96
name = "hotdata-marimo"
107
version = "0.1.0"
@@ -13,7 +10,7 @@ readme = "README.md"
1310
requires-python = ">=3.10"
1411
license = { text = "MIT" }
1512
dependencies = [
16-
"hotdata-runtime @ git+https://github.com/hotdata-dev/hotdata-runtime.git",
13+
"hotdata-runtime>=0.1.0",
1714
"marimo>=0.10.0",
1815
]
1916

0 commit comments

Comments
 (0)