Skip to content

Commit 7592255

Browse files
authored
chore: get uv release to work properly (#562)
* chore: get uv release to work properly * chore: build system to make sure it doesn't break * chore: try running a test release on every PR * chore: fix test release * chore: add a temp main branch for testing * chore: fix branches
1 parent 82f6dc2 commit 7592255

File tree

2 files changed

+62
-1
lines changed

2 files changed

+62
-1
lines changed

.github/workflows/ci.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,60 @@ jobs:
4949
- name: Test with Pytest
5050
run: uv run pytest --log-cli-level=DEBUG -vv -s
5151
shell: bash
52+
53+
build:
54+
name: Build Package
55+
runs-on: ubuntu-latest
56+
steps:
57+
- uses: actions/checkout@v5
58+
- name: Set up uv
59+
uses: astral-sh/setup-uv@v7
60+
with:
61+
python-version: "3.11"
62+
activate-environment: true
63+
- name: Build package
64+
run: uv build
65+
66+
# Test semantic-release configuration on PR branches
67+
test-release:
68+
name: Test Semantic Release
69+
runs-on: ubuntu-latest
70+
if: github.event_name == 'pull_request'
71+
steps:
72+
- uses: actions/checkout@v5
73+
with:
74+
fetch-depth: 0
75+
- name: Setup Git for Semantic Release Testing
76+
run: |
77+
# Setup a temp branch to test
78+
git checkout -B temp-main-branch
79+
git merge ${{ github.event.pull_request.head.sha }} --no-edit
80+
git config user.name "GitHub Actions"
81+
git config user.email "actions@github.com"
82+
- name: Test Semantic Release (No-op)
83+
id: test-release
84+
uses: python-semantic-release/python-semantic-release@v10.4.1
85+
with:
86+
github_token: ${{ secrets.GITHUB_TOKEN }}
87+
changelog: true
88+
# Use noop mode to test without making changes
89+
no_operation_mode: true
90+
- name: Test Semantic Release (Dry Run)
91+
id: test-release-dry
92+
uses: python-semantic-release/python-semantic-release@v10.4.1
93+
with:
94+
github_token: ${{ secrets.GITHUB_TOKEN }}
95+
changelog: true
96+
# Use dry run mode to test without committing
97+
commit: false
98+
tag: false
99+
push: false
100+
vcs_release: false
52101
release:
53102
runs-on: ubuntu-latest
54103
needs:
55104
- test
105+
- build
56106
concurrency: release
57107
if: github.ref == 'refs/heads/main'
58108
permissions:
@@ -70,6 +120,10 @@ jobs:
70120
with:
71121
fetch-depth: 0
72122
persist-credentials: false
123+
- name: Set up uv
124+
uses: astral-sh/setup-uv@v7
125+
with:
126+
python-version: "3.11"
73127
- name: Python Semantic Release
74128
id: release
75129
uses: python-semantic-release/python-semantic-release@v10.4.1

pyproject.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,16 @@ build-backend = "hatchling.build"
6868

6969
[tool.semantic_release]
7070
branch = "main"
71+
72+
[tool.semantic_release.branches.main]
73+
match = "main"
74+
prerelease = false
75+
76+
[tool.semantic_release.branches.temp-main-branch]
77+
match = "temp-main-branch"
78+
prerelease = false
7179
version_toml = ["pyproject.toml:project.version"]
7280
build_command = """
73-
python -m pip install -e '.[build]'
7481
uv lock --upgrade-package "$PACKAGE_NAME"
7582
git add uv.lock
7683
uv build

0 commit comments

Comments
 (0)