Skip to content

Commit

Permalink
Merge pull request #77 from corytodd/ci-publish-on-gh-release
Browse files Browse the repository at this point in the history
ci: upload to pypi on github release
  • Loading branch information
fzumstein authored Jun 24, 2024
2 parents 6886210 + fc29d2a commit 003977a
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 4 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/python_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Upload Python Package

on:
release:
types: [published]
workflow_dispatch:

permissions:
contents: read

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450 # v1.8.14
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,6 @@ target/
.idea

.hypothesis/

# Ignore auto-generated _version
/jsondiff/_version.py
3 changes: 1 addition & 2 deletions jsondiff/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
__version__ = '2.0.0'

import sys
import json
import yaml
Expand All @@ -9,6 +7,7 @@

from .symbols import *
from .symbols import Symbol
from ._version import __version__

# rules
# - keys and strings which start with $ (or specified escape_str) are escaped to $$ (or escape_str * 2)
Expand Down
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools>=43.0.0", "wheel"]
requires = ["setuptools>=64.0.0", "setuptools_scm>=8", "wheel"]
build-backend = "setuptools.build_meta"

[project]
Expand Down Expand Up @@ -30,8 +30,10 @@ include = ["jsondiff*"]
exclude = ["tests*"]

[tool.setuptools.dynamic]
version = {attr = "jsondiff.__version__"}
dependencies = {file=["requirements.txt"]}

[tool.setuptools_scm]
version_file = "jsondiff/_version.py"

[tool.setuptools.dynamic.optional-dependencies]
dev = {file=["requirements-dev.txt"]}
2 changes: 2 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
hypothesis
pytest
setuptools-scm
build

0 comments on commit 003977a

Please sign in to comment.