File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Publish to PyPI
2+
3+ on :
4+ workflow_dispatch :
5+
6+ permissions :
7+ contents : write
8+ id-token : write
9+
10+ jobs :
11+ publish :
12+ runs-on : ubuntu-latest
13+ if : github.ref == 'refs/heads/main'
14+ environment : pypi
15+ steps :
16+ - uses : actions/checkout@v6
17+ with :
18+ fetch-depth : 0
19+
20+ - name : Install uv
21+ uses : astral-sh/setup-uv@v8.0.0
22+ with :
23+ python-version : " 3.12"
24+
25+ - name : Get version
26+ id : version
27+ run : |
28+ VERSION=$(uv run python -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
29+ echo "version=$VERSION" >> $GITHUB_OUTPUT
30+
31+ - name : Check version not already published
32+ run : |
33+ VERSION="${{ steps.version.outputs.version }}"
34+ if uv pip index versions designer-plugin 2>/dev/null | grep -q "$VERSION"; then
35+ echo "Version $VERSION already exists on PyPI. Aborting."
36+ exit 1
37+ fi
38+
39+ - name : Build package
40+ run : uv build
41+
42+ - name : Tag release
43+ run : |
44+ git config user.name "github-actions[bot]"
45+ git config user.email "github-actions[bot]@users.noreply.github.com"
46+ git tag "v${{ steps.version.outputs.version }}" || echo "Tag already exists, skipping"
47+ git push origin "v${{ steps.version.outputs.version }}" || echo "Tag already pushed, skipping"
48+
49+ - name : Publish to PyPI
50+ uses : pypa/gh-action-pypi-publish@release/v1
You can’t perform that action at this time.
0 commit comments