Skip to content

Commit 19cc380

Browse files
Merge pull request #35 from kevinyamauchi/patch-1
add deploy job to CI
2 parents c8baa62 + 64e0759 commit 19cc380

File tree

2 files changed

+41
-2
lines changed

2 files changed

+41
-2
lines changed

.github/workflows/test.yaml renamed to .github/workflows/test_and_deploy.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: Test
33
on:
44
push:
55
branches: [main]
6+
tags:
7+
- "v[0-9]+(\\.[0-9]+)*(-?(rc|alpha|beta)(\\.[0-9]+)?)?" # Push events to matching v*, i.e. v1.0, v20.15.10, v1.0-rc.1, v2.1-alpha, v3.0-beta.3
68
pull_request:
79
branches: [main]
810

@@ -60,3 +62,29 @@ jobs:
6062
with:
6163
name: coverage
6264
verbose: true
65+
deploy:
66+
# this will run when you have tagged a commit, starting with "v*"
67+
# and requires that you have put your twine API key in your
68+
# github secrets (see readme for details)
69+
needs: [test]
70+
runs-on: ubuntu-latest
71+
if: contains(github.ref, 'tags')
72+
steps:
73+
- name: Checkout code
74+
uses: actions/checkout@v3
75+
76+
- name: Set up Python 3.10
77+
uses: actions/setup-python@v4
78+
with:
79+
python-version: "3.10"
80+
81+
- name: Install hatch
82+
run: pip install hatch
83+
84+
- name: Build project for distribution
85+
run: hatch build
86+
87+
- name: Publish a Python distribution to PyPI
88+
uses: pypa/gh-action-pypi-publish@release/v1
89+
with:
90+
password: ${{ secrets.PYPI_API_TOKEN }}

pyproject.toml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
[build-system]
22
build-backend = "hatchling.build"
3-
requires = ["hatchling"]
3+
requires = ["hatchling", "hatch-vcs"]
44

55

66
[project]
77
name = "spatialdata-io"
8-
version = "0.0.1"
8+
dynamic= [
9+
"version" # allow version to be set by git tags
10+
]
911
description = "SpatialData IO for common techs"
1012
readme = "README.md"
1113
requires-python = ">=3.9"
@@ -96,3 +98,12 @@ formats = "ipynb,md"
9698

9799
[tool.hatch.metadata]
98100
allow-direct-references = true
101+
102+
[tool.hatch.build.targets.wheel]
103+
packages = ['src/spatialdata_io']
104+
105+
[tool.hatch.version]
106+
source = "vcs"
107+
108+
[tool.hatch.build.hooks.vcs]
109+
version-file = "_version.py"

0 commit comments

Comments
 (0)