From c860319e61791a8fcc018d71c02fe1bfc5dcbe7a Mon Sep 17 00:00:00 2001 From: Michael Daniels Date: Sun, 23 Nov 2025 11:20:38 -0500 Subject: [PATCH 1/8] [chore] tag releases automatically --- .github/workflows/publish.yml | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 4ab8f36..39ba012 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,6 +1,14 @@ name: publish -on: [push, workflow_dispatch] +# Note: this workflow evaluates Python code from this repository. +# It therefore must not be run on untrusted input (e.g. on pull requests). +# But that's fine, because we only want to publish when the default branch +# is pushed to (or when a maintainer manually runs this workflow) anyways. +on: + push: + branches: + - main + workflow_dispatch: jobs: diff: @@ -25,6 +33,7 @@ jobs: environment: release if: needs.diff.outputs.CHANGED == 'true' permissions: + contents: write id-token: write steps: - uses: actions/checkout@v4 @@ -37,5 +46,21 @@ jobs: python src/overrides.py 3.6 uv build - name: Publish to PyPI - continue-on-error: true + if: env.GITHUB_REPOSITORY == 'promplate/partial-json-parser' run: uv publish + - name: Read version number + id: read-version + run: | + VERSION="$(grep -m1 -oP '^__version__\s*=\s*"\K[^"]+' src/partial_json_parser/version.py)" + echo "VERSION=$VERSION" >> $GITHUB_OUTPUT + - name: Publish GitHub release + env: + GH_TOKEN: ${{ github.token }} + VERSION: ${{ steps.read-version.outputs.VERSION }} + run: | + gh release create "v$VERSION" \ + --repo="$GITHUB_REPOSITORY" \ + --title="${VERSION#v}" \ + --generate-notes \ + dist/* + From dccb9bdabb923586743fb65ac564b487275757be Mon Sep 17 00:00:00 2001 From: Muspi Merol Date: Fri, 28 Nov 2025 18:33:28 +0800 Subject: [PATCH 2/8] [chore] remove redundant comments --- .github/workflows/publish.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 39ba012..6b36344 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,9 +1,5 @@ name: publish -# Note: this workflow evaluates Python code from this repository. -# It therefore must not be run on untrusted input (e.g. on pull requests). -# But that's fine, because we only want to publish when the default branch -# is pushed to (or when a maintainer manually runs this workflow) anyways. on: push: branches: From 47f9d587faf3f3f1fc00ac43954687d52a2844a5 Mon Sep 17 00:00:00 2001 From: Muspi Merol Date: Fri, 28 Nov 2025 18:35:25 +0800 Subject: [PATCH 3/8] [fix] use correct github.repository syntax in publish.yml condition --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 6b36344..e8a2a5f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -42,7 +42,7 @@ jobs: python src/overrides.py 3.6 uv build - name: Publish to PyPI - if: env.GITHUB_REPOSITORY == 'promplate/partial-json-parser' + if: ${{ github.repository == 'promplate/partial-json-parser' }} run: uv publish - name: Read version number id: read-version From 2452de99e65f53b427ec3b00ba9c552809b1c01e Mon Sep 17 00:00:00 2001 From: Muspi Merol Date: Fri, 28 Nov 2025 18:36:38 +0800 Subject: [PATCH 4/8] [fix] formatting --- .github/workflows/publish.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e8a2a5f..78a1870 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,6 +1,6 @@ name: publish -on: +on: push: branches: - main @@ -59,4 +59,3 @@ jobs: --title="${VERSION#v}" \ --generate-notes \ dist/* - From ce0f54b887248b5295ca9f2d3cbf8800a7bae6e9 Mon Sep 17 00:00:00 2001 From: Muspi Merol Date: Fri, 28 Nov 2025 18:49:21 +0800 Subject: [PATCH 5/8] [fix] correct release title format --- .github/workflows/publish.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 78a1870..cc22d3d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -51,11 +51,9 @@ jobs: echo "VERSION=$VERSION" >> $GITHUB_OUTPUT - name: Publish GitHub release env: - GH_TOKEN: ${{ github.token }} VERSION: ${{ steps.read-version.outputs.VERSION }} run: | gh release create "v$VERSION" \ - --repo="$GITHUB_REPOSITORY" \ - --title="${VERSION#v}" \ + --title="v$VERSION" \ --generate-notes \ dist/* From 5f5517923016ead1d03e471a585597198380ff8d Mon Sep 17 00:00:00 2001 From: Muspi Merol Date: Fri, 28 Nov 2025 19:04:45 +0800 Subject: [PATCH 6/8] [fix] simplify gh release command formatting --- .github/workflows/publish.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index cc22d3d..74874df 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -53,7 +53,4 @@ jobs: env: VERSION: ${{ steps.read-version.outputs.VERSION }} run: | - gh release create "v$VERSION" \ - --title="v$VERSION" \ - --generate-notes \ - dist/* + gh release create v$VERSION --title=v$VERSION --generate-notes dist/* From 5ca90e308bcd98d322ccdeda2d0d15e35c799610 Mon Sep 17 00:00:00 2001 From: Muspi Merol Date: Fri, 28 Nov 2025 19:08:59 +0800 Subject: [PATCH 7/8] [chore] reorder publish workflow steps --- .github/workflows/publish.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 74874df..289407e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -41,9 +41,6 @@ jobs: run: | python src/overrides.py 3.6 uv build - - name: Publish to PyPI - if: ${{ github.repository == 'promplate/partial-json-parser' }} - run: uv publish - name: Read version number id: read-version run: | @@ -54,3 +51,6 @@ jobs: VERSION: ${{ steps.read-version.outputs.VERSION }} run: | gh release create v$VERSION --title=v$VERSION --generate-notes dist/* + - name: Publish to PyPI + if: ${{ github.repository == 'promplate/partial-json-parser' }} + run: uv publish From 0b215b60b19cf5082a28f10e9cf234c6f844b785 Mon Sep 17 00:00:00 2001 From: Muspi Merol Date: Fri, 28 Nov 2025 21:48:00 +0800 Subject: [PATCH 8/8] [chore] merge version read into release step --- .github/workflows/publish.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 289407e..a547642 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -41,15 +41,9 @@ jobs: run: | python src/overrides.py 3.6 uv build - - name: Read version number - id: read-version + - name: Create GitHub release run: | VERSION="$(grep -m1 -oP '^__version__\s*=\s*"\K[^"]+' src/partial_json_parser/version.py)" - echo "VERSION=$VERSION" >> $GITHUB_OUTPUT - - name: Publish GitHub release - env: - VERSION: ${{ steps.read-version.outputs.VERSION }} - run: | gh release create v$VERSION --title=v$VERSION --generate-notes dist/* - name: Publish to PyPI if: ${{ github.repository == 'promplate/partial-json-parser' }}