-
Notifications
You must be signed in to change notification settings - Fork 10
50 lines (48 loc) · 1.33 KB
/
Copy pathpublish.yml
File metadata and controls
50 lines (48 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: publish
on:
push:
branches:
- main
workflow_dispatch:
jobs:
diff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Check for changes
id: changes-check
run: |
if git diff --quiet HEAD~1 HEAD -- src/partial_json_parser/version.py; then
echo "CHANGED=false" >> $GITHUB_OUTPUT
else
echo "CHANGED=true" >> $GITHUB_OUTPUT
fi
outputs:
CHANGED: ${{ steps.changes-check.outputs.CHANGED }}
publish:
runs-on: ubuntu-latest
needs: diff
environment: release
if: needs.diff.outputs.CHANGED == 'true'
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4
- name: Set up python
uses: astral-sh/setup-uv@v5
with:
python-version: 3.13
- name: Build package
run: |
python src/overrides.py 3.6
uv build
- name: Create GitHub release
run: |
VERSION="$(grep -m1 -oP '^__version__\s*=\s*"\K[^"]+' src/partial_json_parser/version.py)"
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