Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

ci: release script creates a branch (#8669)

Myles Scolnick95907b73c894
diff --git a/.github/workflows/release-tag.yml b/.github/workflows/release-tag.yml
new file mode 100644
index 0000000000..e44c75203d
--- /dev/null
+++ b/.github/workflows/release-tag.yml
@@ -0,0 +1,60 @@
+name: Auto-tag Release
+
+# When a release PR is merged, create and push the version tag.
+# The tag push then triggers the production release workflow.
+on:
+ pull_request:
+ types: [closed]
+
+jobs:
+ create-tag:
+ if: >-
+ github.event.pull_request.merged == true &&
+ github.event.pull_request.base.ref == 'main' &&
+ startsWith(github.event.pull_request.title, 'release: ')
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ steps:
+ - name: Extract version from PR title
+ id: version
+ env:
+ PR_TITLE: ${{ github.event.pull_request.title }}
+ run: |
+ VERSION="${PR_TITLE#release: }"
+ if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
+ echo "::error::Invalid version format: $VERSION"
+ exit 1
+ fi
+ echo "version=$VERSION" >> "$GITHUB_OUTPUT"
+
+ # Use a GitHub App token so the tag push triggers other workflows.
+ # Tags pushed with the default GITHUB_TOKEN do not trigger workflows.
+ - name: Generate app token
+ id: app-token
+ uses: actions/create-github-app-token@v1
+ with:
+ app-id: ${{ vars.RELEASE_APP_ID }}
+ private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
+
+ - name: Checkout
+ uses: actions/checkout@v4
+ with:
+ ref: ${{ github.event.pull_request.merge_commit_sha }}
+ token: ${{ steps.app-token.outputs.token }}
+
+ - name: Verify version in pyproject.toml
+ run: |
+ TOML_VERSION=$(grep -m1 '^version' pyproject.toml | sed 's/.*"\(.*\)".*/\1/')
+ if [ "$TOML_VERSION" != "${{ steps.version.outputs.version }}" ]; then
+ echo "::error::Version mismatch: PR title says ${{ steps.version.outputs.version }}, pyproject.toml says $TOML_VERSION"
+ exit 1
+ fi
+
+ - name: Create and push tag
+ run: |
+ git config user.name "github-actions[bot]"
+ git config user.email "github-actions[bot]@users.noreply.github.com"
+ VERSION="${{ steps.version.outputs.version }}"
+ git tag -a "$VERSION" -m "release: $VERSION"
+ git push origin "$VERSION"
diff --git a/scripts/release.sh b/scripts/release.sh
index a7311ef71e..0f89d6a91a 100755
--- a/scripts/release.sh
+++ b/scripts/release.sh
@@ -51,6 +51,12 @@ if [[ ! "$VERSION_TYPE" =~ ^(minor|patch)$ ]]; then
exit 1
fi
+# Check gh CLI is available
+if ! command -v gh &> /dev/null; then
+ print_error "gh CLI is required but not installed. See https://cli.github.com/"
+ exit 1
+fi
+
# Check if on main branch
print_step "Checking git branch"
BRANCH=$(git branch --show-current)
@@ -82,34 +88,52 @@ NEW_VERSION=$(NO_COLOR=1 uv version --short) # re-run to get the version
# Summary and confirmation
echo -e "\n${BOLD}Release Summary:${NC}"
echo " • New Version: $NEW_VERSION"
-echo " • Files to be committed:"
-echo " - pyproject.toml"
+echo " • A PR will be created: release/$NEW_VERSION -> main"
+echo " • After merge, a tag will be created automatically"
if ! confirm "Proceed with release?"; then
print_warning "Release cancelled"
+ git checkout pyproject.toml
exit 1
fi
-# Commit version change
-print_step "Committing version change"
+# Create release branch and commit
+RELEASE_BRANCH="release/$NEW_VERSION"
+print_step "Creating release branch: $RELEASE_BRANCH"
+git checkout -b "$RELEASE_BRANCH"
git add pyproject.toml
git commit -m "release: $NEW_VERSION"
-# Push changes
-if confirm "Push changes to remote?"; then
- git push origin main
- echo -e "${GREEN}✓ Changes pushed successfully${NC}"
-fi
+# Push branch and create PR
+print_step "Pushing branch and creating PR"
+git push origin "$RELEASE_BRANCH"
-# Create and push tag
-if confirm "Create and push tag $NEW_VERSION?"; then
- git tag -a "$NEW_VERSION" -m "release: $NEW_VERSION"
- git push origin --tags
- echo -e "${GREEN}✓ Tag pushed successfully${NC}"
-fi
+PR_URL=$(gh pr create \
+ --title "release: $NEW_VERSION" \
+ --label "internal" \
+ --body "$(cat <<EOF
+## Release $NEW_VERSION
+
+Bumps version to \`$NEW_VERSION\` ($VERSION_TYPE release).
+
+### After merge
+1. Push to \`main\` triggers a **dev release** (pre-release to PyPI)
+2. The \`release-tag\` workflow detects this merged release PR and creates tag \`$NEW_VERSION\`
+3. Tag push triggers the **production release** (publish to PyPI, Docker, etc.)
+
+### Checklist
+- [ ] CI passes
+- [ ] Version in \`pyproject.toml\` is correct (\`$NEW_VERSION\`)
+EOF
+)")
+
+# Switch back to main
+git checkout main
# Final success message
-echo -e "\n${BOLD}${GREEN}🎉 Release $NEW_VERSION completed successfully! 🎉${NC}\n"
-echo -e "${YELLOW}Don't forget to:${NC}"
-echo " 1. Monitor the release: https://github.com/marimo-team/marimo/actions/workflows/release.yml"
-echo " 2. Draft the release notes: https://github.com/marimo-team/marimo/releases/new?tag=$NEW_VERSION"
+echo -e "\n${BOLD}${GREEN}Release PR created successfully!${NC}\n"
+echo -e " PR: $PR_URL"
+echo -e "\n${YELLOW}Next steps:${NC}"
+echo " 1. Get the PR reviewed and merged"
+echo " 2. After merge, the tag will be created automatically"
+echo " 3. Monitor the release: https://github.com/marimo-team/marimo/actions/workflows/release.yml"