Skip to content

Commit 2140d39

Browse files
fix: update publish workflow, release-please version search, gitignore (#9)
1 parent 1869a80 commit 2140d39

3 files changed

Lines changed: 49 additions & 3 deletions

File tree

‎.github/workflows/publish.yml‎

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,61 @@
11
name: Publish
22

33
on:
4-
release:
5-
types: [published]
4+
workflow_run:
5+
workflows: ["Release Please"]
6+
types: [completed]
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: "Release tag to publish (e.g. pg-partsmith-v0.1.0)"
11+
required: true
612

713
permissions:
14+
contents: read
815
id-token: write # Trusted Publisher (PyPI OIDC)
916

1017
jobs:
18+
check:
19+
name: Check release tag
20+
if: >
21+
github.event_name == 'workflow_dispatch' ||
22+
(github.event.workflow_run.conclusion == 'success' &&
23+
github.event.workflow_run.head_branch == 'master')
24+
runs-on: ubuntu-latest
25+
outputs:
26+
tag: ${{ steps.tag.outputs.tag }}
27+
steps:
28+
- uses: actions/checkout@v6
29+
with:
30+
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.event.workflow_run.head_sha }}
31+
fetch-tags: true
32+
33+
- name: Resolve tag
34+
id: tag
35+
run: |
36+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
37+
echo "tag=${{ inputs.tag }}" >> "$GITHUB_OUTPUT"
38+
else
39+
TAG=$(git tag --points-at HEAD | grep -E '^pg-partsmith-v' | head -1)
40+
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
41+
if [ -z "$TAG" ]; then
42+
echo "No release tag on this commit — skipping publish."
43+
else
44+
echo "Will publish $TAG"
45+
fi
46+
fi
47+
1148
publish:
1249
name: Build and publish to PyPI
50+
needs: check
51+
if: needs.check.outputs.tag != ''
1352
runs-on: ubuntu-latest
1453
environment: pypi
1554
steps:
1655
- uses: actions/checkout@v6
56+
with:
57+
ref: ${{ needs.check.outputs.tag }}
58+
1759
- uses: astral-sh/setup-uv@v7
1860
- run: uv build
1961
- run: uv publish

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,6 @@ dmypy.json
128128

129129
# Pyre type checker
130130
.pyre/
131+
132+
# Claude Code worktrees
133+
.claude/worktrees/

‎release-please-config.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"extra-files": [
99
{
1010
"type": "generic",
11-
"path": "pg_partsmith/__version__.py"
11+
"path": "pg_partsmith/__version__.py",
12+
"search": "__version__ = \"$1\""
1213
}
1314
]
1415
}

0 commit comments

Comments
 (0)