-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (44 loc) · 1.28 KB
/
python-publish.yml
File metadata and controls
55 lines (44 loc) · 1.28 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
51
52
53
54
55
name: Python Publish
on:
release:
types: [published]
jobs:
publish:
name: Publish
runs-on: ubuntu-latest
defaults:
run:
working-directory: python
permissions:
contents: write # Required to upload release artifacts
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Poetry
run: |
pip install poetry
- name: Validate tag format
run: |
if [[ ! "$GITHUB_REF_NAME" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[a-z0-9\.]+)?$ ]]; then
echo "Invalid tag format: $GITHUB_REF_NAME"
echo "Expected: v<MAJOR>.<MINOR>.<PATCH> (e.g., v1.2.3 or v1.2.3-beta.1)"
exit 1
fi
- name: Set version from tag
run: |
VERSION=${GITHUB_REF_NAME#v}
echo "Setting poetry version to $VERSION"
poetry version $VERSION
- name: Install dependencies
run: poetry install --no-root
- name: Build package
run: poetry build
- name: Upload dist artifacts to GitHub Release
uses: softprops/action-gh-release@v2
with:
files: |
python/dist/*.whl