-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (46 loc) · 1.57 KB
/
Copy pathrelease-python.yml
File metadata and controls
48 lines (46 loc) · 1.57 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
name: Release Python
on:
workflow_dispatch:
push:
branches: [develop]
jobs:
check:
runs-on: ubuntu-latest
outputs:
should-publish: ${{ steps.check.outputs.publish }}
version: ${{ steps.check.outputs.version }}
steps:
- uses: actions/checkout@v5
- id: check
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "publish=true" >> $GITHUB_OUTPUT
VERSION=$(grep -m1 '^version' packages/debugger-py/pyproject.toml | sed 's/.*"\(.*\)".*/\1/')
echo "version=$VERSION" >> $GITHUB_OUTPUT
exit 0
fi
COMMITS='${{ toJSON(github.event.commits.*.message) }}'
VERSION=$(echo "$COMMITS" | sed -n 's/.*release(python): v\([0-9.]*\).*/\1/p' | tail -1)
if [[ -n "$VERSION" ]]; then
echo "publish=true" >> $GITHUB_OUTPUT
echo "version=$VERSION" >> $GITHUB_OUTPUT
else
echo "publish=false" >> $GITHUB_OUTPUT
fi
publish:
needs: check
if: needs.check.outputs.should-publish == 'true'
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v5
- uses: astral-sh/setup-uv@v5
- run: cd packages/debugger-py && uv build
- run: cd packages/debugger-py && uv publish --trusted-publishing always
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: debugger-py-v${{ needs.check.outputs.version }}
generate_release_notes: true