Skip to content

Commit

Permalink
Merge pull request #203 from authzed/get-automatic-version-bumping-wo…
Browse files Browse the repository at this point in the history
…rking

Get automatic version bumping working
  • Loading branch information
vroldanbet authored Sep 11, 2024
2 parents a5e4e3a + ee846f1 commit ae16dfb
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 21 deletions.
7 changes: 0 additions & 7 deletions .github/workflows/automatic-api-update.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,6 @@ jobs:
UPDATED_STATUS: "${{ steps.buf-update.outputs.updated }}"
run: |
echo "Update status: $UPDATED_STATUS"
- name: "Update package version"
uses: "authzed/actions/semver-update@main"
if: "steps.buf-update.outputs.updated == 'true'"
with:
sourcefile-path: "pyproject.toml"
version-regex: 'name = "authzed"\nversion = "(.+)"'
version-change: "minor"
- name: "Install buf"
uses: "bufbuild/[email protected]"
with:
Expand Down
7 changes: 0 additions & 7 deletions .github/workflows/manual-api-update.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,6 @@ jobs:
UPDATED_STATUS: "${{ steps.buf-update.outputs.updated }}"
run: |
echo "Update status: $UPDATED_STATUS"
- name: "Update package version"
uses: "authzed/actions/semver-update@main"
if: "steps.buf-update.outputs.updated == 'true'"
with:
sourcefile-path: "pyproject.toml"
version-regex: 'name = "authzed"\nversion = "(.+)"'
version-change: "minor"
- name: "Install buf"
uses: "bufbuild/[email protected]"
with:
Expand Down
21 changes: 16 additions & 5 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,32 @@
---
name: "Publish to PyPI"
on: "push"
on:
release:
types:
- "published"
jobs:
publish:
name: "Build & Publish"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v4"
- name: "Install Poetry"
uses: "snok/install-poetry@v1"
- uses: "actions/setup-python@v5"
with:
python-version: "3.11"
- name: "Install pypa/build"
run: "python -m pip install build --user"
cache: 'poetry'
# This gives us a version number without the release prefix
- name: "Write release version"
run: |
VERSION=${GITHUB_REF_NAME#v}
echo Version: $VERSION
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: "Set the release number in pyproject.toml"
run: "poetry version -s $VERSION"
- name: "Build wheel and source tarball"
run: "python -m build --sdist --wheel --outdir dist/ ."
run: "poetry build"
- name: "Publish"
if: "startsWith(github.ref, 'refs/tags')"
uses: "pypa/gh-action-pypi-publish@release/v1"
with:
password: "${{ secrets.PYPI_API_TOKEN }}"
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
authors = ["Authzed <[email protected]>"]
description = "Client library for SpiceDB."

# NOTE: These two lines must be kept together for the API update action to function
name = "authzed"
version = "0.18.1"
# The version is set at publish time with a call to `poetry version -s <tag>`,
# where the tag comes from the release.
version = "0.0.0"
packages = [
{include = "authzed"},
{include = "validate"},
Expand Down

0 comments on commit ae16dfb

Please sign in to comment.