Skip to content

Commit 9f1705f

Browse files
authored
[pypi] Add github action for pypi publishing (#7)
1 parent 89d132a commit 9f1705f

File tree

4 files changed

+50
-15
lines changed

4 files changed

+50
-15
lines changed

.github/workflows/release.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Upload Python Package
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
jobs:
9+
pypi-publish:
10+
name: upload release to PyPI
11+
runs-on: ubuntu-latest
12+
environment: release
13+
permissions:
14+
id-token: write
15+
16+
steps:
17+
- name: "Checkout code"
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Python 3.12
21+
uses: actions/setup-python@v4
22+
with:
23+
python-version: "3.12"
24+
25+
- name: Setup pdm
26+
uses: pdm-project/setup-pdm@v3
27+
with:
28+
python-version: "3.12"
29+
30+
- name: Build package
31+
run: pdm build
32+
33+
- name: Publish package distributions to PyPI
34+
uses: pypa/gh-action-pypi-publish@release/v1

pyproject.toml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ authors = [
1010
maintainers = [
1111
{name = "Modular Inc", email = "[email protected]"}
1212
]
13-
description = "Stacked PRs for GitHub"
14-
version = "1.0"
13+
description = "Stacked PRs for GitHub."
1514
readme = "README.md"
1615
license = { file = "LICENSE" }
1716
requires-python = ">=3.8"
@@ -23,7 +22,8 @@ classifiers = [
2322
"License :: OSI Approved :: Apache Software License",
2423
"Programming Language :: Python",
2524
]
26-
dependencies = []
25+
# Version is dynamically set by pdm by the SCM version
26+
dynamic = ["version"]
2727

2828
[project.urls]
2929
Homepage = "https://github.com/modularml/stack-pr"
@@ -35,13 +35,16 @@ stack-pr = "stack_pr.cli:main"
3535

3636
[tool.pdm]
3737
distribution = true
38+
source = "scm"
39+
fallback_version = "0.0.0"
3840

3941
[tool.pixi.project]
4042
channels = ["conda-forge"]
4143
platforms = ["osx-arm64", "osx-64", "linux-64", "linux-aarch64"]
4244

4345
[tool.pixi.pypi-dependencies]
4446
stack-pr = { path = ".", editable = true }
47+
pdm = ">=2.17.1,<2.18"
4548

4649
[tool.pixi.tasks]
4750

src/stack_pr/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from .stack_pr import main
1+
from .cli import main
22

33
if __name__ == "__main__":
44
main()

src/stack_pr/cli.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
#!/usr/bin/env python3
2-
#
31
# stack-pr: a tool for working with stacked PRs on github.
42
#
5-
# ------------------
6-
# stack-pr.py submit
7-
# ------------------
3+
# ---------------
4+
# stack-pr submit
5+
# ---------------
86
#
97
# Semantics:
108
# 1. Find merge-base (the most recent commit from 'main' in the current branch)
@@ -23,9 +21,9 @@
2321
# branch of each PR will be the head branch of the previous PR, or 'main' for
2422
# the first PR in the stack.
2523
#
26-
# ----------------
27-
# stack-pr.py land
28-
# ----------------
24+
# -------------
25+
# stack-pr land
26+
# -------------
2927
#
3028
# Semantics:
3129
# 1. Find merge-base (the most recent commit from 'main' in the current branch)
@@ -38,9 +36,9 @@
3836
# If 'land' succeeds, all the PRs from the stack will be merged into 'main',
3937
# all the corresponding remote and local branches deleted.
4038
#
41-
# -------------------
42-
# stack-pr.py abandon
43-
# -------------------
39+
# ----------------
40+
# stack-pr abandon
41+
# ----------------
4442
#
4543
# Semantics:
4644
# For all commits in the stack that have valid stack-info:

0 commit comments

Comments
 (0)