Skip to content
This repository was archived by the owner on Mar 16, 2026. It is now read-only.

Commit 854909e

Browse files
committed
chore(docs): update PyPI publishing workflow and clarify release process
- Updated the PyPI publishing workflow to indicate that it is now handled by the release-on-tag.yml file, which is the preferred method for publishing to PyPI. - Added comments to clarify the need for a Trusted Publisher configuration and the limitations of using GITHUB_TOKEN for triggering workflows. - Enhanced the release-on-tag.yml workflow to include steps for pushing versioned documentation to the main branch and publishing to PyPI, ensuring a streamlined release process.
1 parent fc02f60 commit 854909e

File tree

2 files changed

+39
-23
lines changed

2 files changed

+39
-23
lines changed

.github/workflows/pypi-publish.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
# Publish hivemind-ai to PyPI when a GitHub release is published.
2-
# Setup: Configure a Trusted Publisher on PyPI for this repo (no API token needed).
1+
# Legacy: PyPI is now published from release-on-tag.yml (same workflow as the release).
2+
# This file is kept for reference. Creating a release with GITHUB_TOKEN does not trigger
3+
# release:published, so this workflow would not run on tag push. Configure PyPI Trusted
4+
# Publisher with workflow filename release-on-tag.yml instead.
5+
#
36
# See: https://docs.pypi.org/trusted-publishers/adding-a-published-publisher/
47

58
name: Publish to PyPI

.github/workflows/release-on-tag.yml

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
# When you push a version tag (e.g. v1.6.0), create a GitHub Release and open a PR for versioned docs.
2-
# Note: Creating a release with GITHUB_TOKEN does NOT trigger other workflows (e.g. docs on release),
3-
# so we run the versioned-docs step here in the same workflow.
1+
# When you push a version tag (e.g. v1.6.0), create a GitHub Release, push versioned docs to main, and publish to PyPI.
2+
# Note: Creating a release with GITHUB_TOKEN does NOT trigger other workflows, so we run versioned-docs and PyPI here.
43
#
54
# Usage:
65
# git tag v1.6.0
76
# git push origin v1.6.0
87
#
9-
# If main has already diverged (e.g. from an older workflow): git fetch origin && git checkout main && git pull --rebase origin main
8+
# PyPI: Add a Trusted Publisher on PyPI with workflow filename release-on-tag.yml (job: pypi-publish).
109

1110
name: Release on tag
1211

@@ -36,7 +35,6 @@ jobs:
3635
- name: Extract changelog section
3736
run: |
3837
V="${{ steps.version.outputs.version }}"
39-
# Match "## [1.6.0]" or "## [1.6.0] - TBD" and print until next ##
4038
awk -v ver="$V" '
4139
$0 ~ "^## \\[" ver "\\]" { found=1; next }
4240
found && /^## \[/ { exit }
@@ -54,12 +52,11 @@ jobs:
5452
env:
5553
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5654

57-
add-version-docs:
55+
push-version-docs:
5856
needs: release
5957
runs-on: ubuntu-latest
6058
permissions:
6159
contents: write
62-
pull-requests: write
6360
steps:
6461
- name: Checkout main
6562
uses: actions/checkout@v4
@@ -86,18 +83,34 @@ jobs:
8683
npm ci
8784
npx docusaurus docs:version ${{ steps.version.outputs.version }}
8885
89-
- name: Open PR for versioned docs
90-
uses: peter-evans/create-pull-request@v7
86+
- name: Push versioned docs to main
87+
run: |
88+
git config user.name "github-actions[bot]"
89+
git config user.email "github-actions[bot]@users.noreply.github.com"
90+
git add website/versioned_docs website/versioned_sidebars website/versions.json
91+
git diff --staged --quiet || git commit -m "chore(docs): add version ${{ steps.version.outputs.version }}"
92+
git push origin HEAD:main
93+
94+
pypi-publish:
95+
needs: release
96+
runs-on: ubuntu-latest
97+
permissions:
98+
contents: read
99+
id-token: write
100+
steps:
101+
- name: Checkout
102+
uses: actions/checkout@v4
103+
104+
- name: Set up Python
105+
uses: actions/setup-python@v5
91106
with:
92-
token: ${{ secrets.GITHUB_TOKEN }}
93-
branch: "docs/version-${{ steps.version.outputs.version }}"
94-
base: main
95-
title: "chore(docs): add version ${{ steps.version.outputs.version }}"
96-
body: |
97-
Versioned docs for **v${{ steps.version.outputs.version }}**. Merge to update the docs site.
98-
commit-message: "chore(docs): add version ${{ steps.version.outputs.version }}"
99-
add-paths: |
100-
website/versioned_docs
101-
website/versioned_sidebars
102-
website/versions.json
103-
delete-branch: true
107+
python-version: "3.12"
108+
109+
- name: Install build
110+
run: pip install build
111+
112+
- name: Build package
113+
run: python -m build
114+
115+
- name: Publish to PyPI
116+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)