Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 43 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,61 @@
name: Publish

on:
release:
types: [published]
workflow_run:
workflows: ["Release Please"]
types: [completed]
workflow_dispatch:
inputs:
tag:
description: "Release tag to publish (e.g. mattermind-v0.1.0)"
required: true

permissions:
contents: read
id-token: write # Trusted Publisher (PyPI OIDC)

jobs:
check:
name: Check release tag
if: >
github.event_name == 'workflow_dispatch' ||
(github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.head_branch == 'master')
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.tag.outputs.tag }}
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.event.workflow_run.head_sha }}
fetch-tags: true

- name: Resolve tag
id: tag
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "tag=${{ inputs.tag }}" >> "$GITHUB_OUTPUT"
else
TAG=$(git tag --points-at HEAD | grep -E '^mattermind-v' | head -1)
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
if [ -z "$TAG" ]; then
echo "No release tag on this commit — skipping publish."
else
echo "Will publish $TAG"
fi
fi

publish:
name: Build and publish to PyPI
needs: check
if: needs.check.outputs.tag != ''
runs-on: ubuntu-latest
environment: pypi
steps:
- uses: actions/checkout@v6
with:
ref: ${{ needs.check.outputs.tag }}

- uses: astral-sh/setup-uv@v7
- run: uv build
- run: uv publish
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,6 @@ dmypy.json

# Pyre type checker
.pyre/

# Claude Code worktrees
.claude/worktrees/
3 changes: 2 additions & 1 deletion release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"extra-files": [
{
"type": "generic",
"path": "src/mattermind/__version__.py"
"path": "src/mattermind/__version__.py",
"search": "__version__ = \"$1\""
}
]
}
Expand Down