Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 0 additions & 41 deletions .github/workflows/publish-to-test-pypi.yml

This file was deleted.

54 changes: 54 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Publish to PyPI

# A release is a tag, not a push to main:
# 1. bump __version__ in partialjson/__init__.py and add a CHANGELOG entry
# 2. merge to main
# 3. git tag vX.Y.Z && git push origin vX.Y.Z
# Pushes to the "development" branch still go to TestPyPI.

on:
push:
tags:
- "v*"
branches:
- development

jobs:
build-n-publish:
name: Build and publish
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Check that the tag matches the package version
if: startsWith(github.ref, 'refs/tags/v')
run: |
tag="${GITHUB_REF_NAME#v}"
version="$(python -c 'import re; print(re.search(r"__version__ = \"([^\"]+)\"", open("partialjson/__init__.py").read()).group(1))')"
if [ "$tag" != "$version" ]; then
echo "Tag v$tag does not match __version__ = $version" >&2
exit 1
fi

- name: Build sdist and wheel
run: |
python -m pip install --upgrade build
python -m build --sdist --wheel --outdir dist/ .

- name: Publish to TestPyPI (development branch)
if: github.ref == 'refs/heads/development'
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/

- name: Publish to PyPI (tag)
if: startsWith(github.ref, 'refs/tags/v')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ Please refer to each project's style and contribution guidelines for submitting

1. **Fork** the repo on GitHub
2. **Clone** the project to your own machine
3. **Update the Version** inside `partialjson/__init__.py` and add a `CHANGELOG.md` entry
3. **Update the Version** inside `partialjson/__init__.py` and add a `CHANGELOG.md` entry (a release is published to PyPI when a `vX.Y.Z` tag is pushed, not on merge)
4. **Commit** changes to your own branch
5. **Push** your work back up to your fork
6. Submit a **Pull request** so that we can review your changes
Loading