Skip to content

Commit aa1d238

Browse files
Merge pull request #66 from scverse/kevinyamauchi-patch-1
add deploy to github actions
2 parents b7f2330 + 9c4f090 commit aa1d238

File tree

2 files changed

+42
-3
lines changed

2 files changed

+42
-3
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*" # Push events to matching v*, i.e. v1.0, v20.15.10
68
pull_request:
79
branches: [main]
810

@@ -76,3 +78,29 @@ jobs:
7678
with:
7779
name: coverage
7880
verbose: true
81+
deploy:
82+
# this will run when you have tagged a commit, starting with "v*"
83+
# and requires that you have put your twine API key in your
84+
# github secrets (see readme for details)
85+
needs: [test]
86+
runs-on: ubuntu-latest
87+
if: contains(github.ref, 'tags')
88+
steps:
89+
- name: Checkout code
90+
uses: actions/checkout@v3
91+
92+
- name: Set up Python 3.10
93+
uses: actions/setup-python@v4
94+
with:
95+
python-version: "3.10"
96+
97+
- name: Install hatch
98+
run: pip install hatch
99+
100+
- name: Build project for distribution
101+
run: hatch build
102+
103+
- name: Publish a Python distribution to PyPI
104+
uses: pypa/gh-action-pypi-publish@release/v1
105+
with:
106+
password: ${{ secrets.PYPI_API_TOKEN }}

pyproject.toml

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

55

66
[project]
@@ -15,7 +15,9 @@ maintainers = [
1515
urls.Documentation = "https://spatialdata.scverse.org/projects/plot/en/latest/"
1616
urls.Source = "https://github.com/scverse/spatialdata-plot.git"
1717
urls.Home-page = "https://github.com/scverse/spatialdata-plot.git"
18-
version = "0.0.1.dev1"
18+
dynamic= [
19+
"version" # allow version to be set by git tags
20+
]
1921
requires-python = ">=3.9"
2022
license = {file = "LICENSE"}
2123
readme = "README.md"
@@ -101,6 +103,15 @@ formats = "ipynb,md"
101103
[tool.hatch.metadata]
102104
allow-direct-references = true
103105

106+
[tool.hatch.build.targets.wheel]
107+
packages = ['src/spatialdata_plot']
108+
109+
[tool.hatch.version]
110+
source = "vcs"
111+
112+
[tool.hatch.build.hooks.vcs]
113+
version-file = "_version.py"
114+
104115
[tool.ruff]
105116
exclude = [
106117
".git",
@@ -162,4 +173,4 @@ target-version = "py39"
162173
convention = "numpy"
163174
[tool.ruff.pyupgrade]
164175
# Preserve types, even if a file imports `from __future__ import annotations`.
165-
keep-runtime-typing = true
176+
keep-runtime-typing = true

0 commit comments

Comments
 (0)