Skip to content

Commit 2d8bb5d

Browse files
committed
Adding publishing to CI.
1 parent 5660c97 commit 2d8bb5d

File tree

2 files changed

+75
-0
lines changed

2 files changed

+75
-0
lines changed

.github/workflows/publish.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Publish to PyPI and TestPyPI
2+
3+
on: push
4+
5+
jobs:
6+
build:
7+
name: Build
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
with:
12+
persist-credentials: false
13+
- name: Set up Python
14+
uses: actions/setup-python@v5
15+
with:
16+
python-version: "3.x"
17+
- name: Install build
18+
run: python3 -m pip install build --user
19+
- name: Build a binary wheel and a source tarball
20+
run: python3 -m build
21+
- name: Store the distribution packages
22+
uses: actions/upload-artifact@v4
23+
with:
24+
name: python-package-distributions
25+
path: dist/
26+
27+
publish-to-pypi:
28+
name: Publish to PyPI
29+
if: startsWith(github.ref, 'refs/tags/')
30+
needs:
31+
- build
32+
runs-on: ubuntu-latest
33+
environment:
34+
name: pypi
35+
url: https://pypi.org/p/jitcode
36+
permissions:
37+
id-token: write
38+
39+
steps:
40+
- name: Download all the dists
41+
uses: actions/download-artifact@v4
42+
with:
43+
name: python-package-distributions
44+
path: dist/
45+
- name: Publish distribution
46+
uses: pypa/gh-action-pypi-publish@release/v1
47+
with:
48+
verbose: true
49+
50+
publish-to-testpypi:
51+
name: Publish to TestPyPI
52+
needs:
53+
- build
54+
runs-on: ubuntu-latest
55+
56+
environment:
57+
name: testpypi
58+
url: https://test.pypi.org/p/jitcode
59+
60+
permissions:
61+
id-token: write
62+
63+
steps:
64+
- name: Download all the dists
65+
uses: actions/download-artifact@v4
66+
with:
67+
name: python-package-distributions
68+
path: dist/
69+
- name: Publish distribution to TestPyPI
70+
uses: pypa/gh-action-pypi-publish@release/v1
71+
with:
72+
skip-existing: true
73+
verbose: true
74+
repository-url: https://test.pypi.org/legacy/

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ jitcode = [
5454

5555
[tool.setuptools_scm]
5656
write_to = "jitcode/version.py"
57+
local_scheme = "no-local-version"
5758

5859
[tool.ruff]
5960
target-version = "py37"

0 commit comments

Comments
 (0)