-
Notifications
You must be signed in to change notification settings - Fork 5
70 lines (57 loc) · 1.71 KB
/
publish.yml
File metadata and controls
70 lines (57 loc) · 1.71 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Publish to PyPI
on:
push:
tags:
- 'v*'
permissions:
contents: read
jobs:
# Run lint first to make sure the tag is good
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.13'
- name: Install dependencies
run: pip install flake8 black
- name: Run Black (Code Formatting)
run: black --check --line-length=120 src/workbench applications tests
- name: Run Flake8 (Linting)
run: flake8 --exclude '*generated*' src/workbench applications tests
publish:
needs: lint
runs-on: ubuntu-latest
permissions:
id-token: write # Required for trusted publishing
contents: write # Required for creating GitHub releases
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0 # Full history for changelog generation
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.13'
- name: Install build tools
run: python -m pip install --upgrade pip build
- name: Build package
run: python -m build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
- name: Create GitHub Release
env:
GH_TOKEN: ${{ github.token }}
run: |
TAG="${GITHUB_REF#refs/tags/}"
PREV_TAG=$(git describe --tags --abbrev=0 "${TAG}^" 2>/dev/null || echo "")
if [ -n "$PREV_TAG" ]; then
NOTES=$(git log --pretty=format:"- %s" "${PREV_TAG}..${TAG}" | head -50)
else
NOTES="Initial release"
fi
gh release create "$TAG" dist/* \
--title "$TAG" \
--notes "$NOTES"