Skip to content

Commit

Permalink
[pypi] Add github action for pypi publishing (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
zbowling authored Jul 30, 2024
1 parent 89d132a commit 9f1705f
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 15 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Upload Python Package

on:
release:
types: [published]
workflow_dispatch:

jobs:
pypi-publish:
name: upload release to PyPI
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write

steps:
- name: "Checkout code"
uses: actions/checkout@v4

- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: "3.12"

- name: Setup pdm
uses: pdm-project/setup-pdm@v3
with:
python-version: "3.12"

- name: Build package
run: pdm build

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
9 changes: 6 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ authors = [
maintainers = [
{name = "Modular Inc", email = "[email protected]"}
]
description = "Stacked PRs for GitHub"
version = "1.0"
description = "Stacked PRs for GitHub."
readme = "README.md"
license = { file = "LICENSE" }
requires-python = ">=3.8"
Expand All @@ -23,7 +22,8 @@ classifiers = [
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
]
dependencies = []
# Version is dynamically set by pdm by the SCM version
dynamic = ["version"]

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

[tool.pdm]
distribution = true
source = "scm"
fallback_version = "0.0.0"

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

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

[tool.pixi.tasks]

Expand Down
2 changes: 1 addition & 1 deletion src/stack_pr/__main__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .stack_pr import main
from .cli import main

if __name__ == "__main__":
main()
20 changes: 9 additions & 11 deletions src/stack_pr/cli.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#!/usr/bin/env python3
#
# stack-pr: a tool for working with stacked PRs on github.
#
# ------------------
# stack-pr.py submit
# ------------------
# ---------------
# stack-pr submit
# ---------------
#
# Semantics:
# 1. Find merge-base (the most recent commit from 'main' in the current branch)
Expand All @@ -23,9 +21,9 @@
# branch of each PR will be the head branch of the previous PR, or 'main' for
# the first PR in the stack.
#
# ----------------
# stack-pr.py land
# ----------------
# -------------
# stack-pr land
# -------------
#
# Semantics:
# 1. Find merge-base (the most recent commit from 'main' in the current branch)
Expand All @@ -38,9 +36,9 @@
# If 'land' succeeds, all the PRs from the stack will be merged into 'main',
# all the corresponding remote and local branches deleted.
#
# -------------------
# stack-pr.py abandon
# -------------------
# ----------------
# stack-pr abandon
# ----------------
#
# Semantics:
# For all commits in the stack that have valid stack-info:
Expand Down

0 comments on commit 9f1705f

Please sign in to comment.