-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (50 loc) · 1.67 KB
/
release.yml
File metadata and controls
61 lines (50 loc) · 1.67 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
name: Publish to PyPI
on:
workflow_dispatch:
permissions:
contents: write
id-token: write
jobs:
ci:
uses: ./.github/workflows/ci.yml
publish:
needs: ci
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
environment: pypi
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v8.0.0
with:
python-version: "3.12"
- name: Get version
id: version
run: |
VERSION=$(uv run python -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Check version not already published
run: |
VERSION="${{ steps.version.outputs.version }}"
if uv pip index versions designer-plugin 2>/dev/null | grep -q "$VERSION"; then
echo "Version $VERSION already exists on PyPI. Aborting."
exit 1
fi
- name: Validate tag does not exist
run: |
if git rev-parse "v${{ steps.version.outputs.version }}" >/dev/null 2>&1; then
echo "Tag v${{ steps.version.outputs.version }} already exists. Aborting."
exit 1
fi
- name: Build package
run: uv build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
- name: Tag release
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag "v${{ steps.version.outputs.version }}"
git push origin "v${{ steps.version.outputs.version }}"