Skip to content

Commit ad3ada1

Browse files
committed
[chore] tag releases automatically
1 parent 3b00143 commit ad3ada1

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

.github/workflows/publish.yml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
name: publish
22

3-
on: [push, workflow_dispatch]
3+
# Note: this workflow evaluates Python code from this repository.
4+
# It therefore must not be run on untrusted input (e.g. on pull requests).
5+
# But that's fine, because we only want to publish when the default branch
6+
# is pushed to (or when a maintainer manually runs this workflow) anyways.
7+
on:
8+
push:
9+
branches:
10+
- with-action
11+
workflow_dispatch:
412

513
jobs:
614
diff:
@@ -25,6 +33,7 @@ jobs:
2533
environment: release
2634
if: needs.diff.outputs.CHANGED == 'true'
2735
permissions:
36+
contents: write
2837
id-token: write
2938
steps:
3039
- uses: actions/checkout@v4
@@ -37,5 +46,20 @@ jobs:
3746
python src/overrides.py 3.6
3847
uv build
3948
- name: Publish to PyPI
40-
continue-on-error: true
49+
if: env.GITHUB_REPOSITORY == 'promplate/partial-json-parser'
4150
run: uv publish
51+
- name: Read version number
52+
id: read-version
53+
run: |
54+
cd src/partial_json_parser
55+
VERSION="$(python -c 'from version import __version__; print(__version__)')"
56+
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
57+
- name: Publish GitHub release
58+
env:
59+
GH_TOKEN: ${{ github.token }}
60+
VERSION: ${{ steps.read-version.outputs.VERSION }}
61+
run: |
62+
gh release create "v$VERSION" \
63+
--repo="$GITHUB_REPOSITORY" \
64+
--title="${VERSION#v}" \
65+
--generate-notes

0 commit comments

Comments
 (0)