Skip to content

Commit de23fd1

Browse files
[CNSL-1935] Add automated release PR workflow
Added GitHub Actions workflow that automatically creates release PRs when pending-deploy-* branches are merged to main. The workflow uses the reusable workflow from cockroachdb/actions and updates all version references across the SDK including CHANGELOG.md, go.mod, config files, and documentation. Co-Authored-By: roachdev-claude <roachdev-claude-bot@cockroachlabs.com>
1 parent 7777b8d commit de23fd1

3 files changed

Lines changed: 76 additions & 0 deletions

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Create Release PR
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
branches:
7+
- main
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: write
12+
pull-requests: write
13+
14+
jobs:
15+
create-release-pr:
16+
# Run on merged PRs with pending-deploy- prefix, or manual workflow_dispatch
17+
if: github.event_name == 'workflow_dispatch' || (github.event.pull_request.merged && startsWith(github.event.pull_request.head.ref, 'pending-deploy-'))
18+
uses: cockroachdb/actions/.github/workflows/create-release-pr.yml@v0
19+
with:
20+
fork_owner: FORK_OWNER #TODO(linhcrl): replace
21+
fork_repo: cockroach-cloud-sdk-go
22+
build_script: internal/update_version.sh
23+
files_to_commit: |
24+
go.mod
25+
internal/spec/config.yaml
26+
README.md
27+
docs/README.md
28+
pkg/client/configuration.go
29+
secrets:
30+
fork_push_token: ${{ secrets.FORK_PUSH_TOKEN }}
31+
pr_create_token: ${{ secrets.GITHUB_TOKEN }}

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
12+
- Automated release workflow that creates release PRs when `pending-deploy-*` branches are merged to main, updating `CHANGELOG.md`, `go.mod`, `internal/spec/config.yaml`, `README.md`, `docs/README.md`, and `pkg/client/configuration.go`
13+
1014
## [7.1.0] - 2026-04-14
1115

1216
### Added

internal/update_version.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# This script is called by the reusable workflow after CHANGELOG.md has been updated.
6+
# The VERSION environment variable is set by the reusable workflow.
7+
# This script should only update version numbers in files other than CHANGELOG.md.
8+
9+
# Check if VERSION environment variable is set
10+
if [ -z "$VERSION" ]; then
11+
echo "Error: VERSION environment variable must be set"
12+
echo "This script is intended to be called by the create-release-pr workflow"
13+
exit 1
14+
fi
15+
16+
echo "Updating version to $VERSION in config and documentation files..."
17+
18+
# Extract major version from VERSION (e.g., 7.0.0 -> 7)
19+
MAJOR_VERSION=$(echo "$VERSION" | cut -d. -f1)
20+
21+
# Update go.mod module path to match major version
22+
echo "Updating go.mod..."
23+
sed -E "s|(github.com/cockroachdb/cockroach-cloud-sdk-go)/v[0-9]+|\1/v${MAJOR_VERSION}|" go.mod > go.mod.tmp && mv go.mod.tmp go.mod
24+
25+
# Update internal/spec/config.yaml
26+
echo "Updating internal/spec/config.yaml..."
27+
sed "s/^packageVersion:.*/packageVersion: $VERSION/" internal/spec/config.yaml > internal/spec/config.yaml.tmp && mv internal/spec/config.yaml.tmp internal/spec/config.yaml
28+
29+
# Update README.md
30+
echo "Updating README.md..."
31+
sed "s/^- Package version:.*/- Package version: $VERSION/" README.md > README.md.tmp && mv README.md.tmp README.md
32+
33+
# Update docs/README.md
34+
echo "Updating docs/README.md..."
35+
sed "s/^- Package version:.*/- Package version: $VERSION/" docs/README.md > docs/README.md.tmp && mv docs/README.md.tmp docs/README.md
36+
37+
# Update pkg/client/configuration.go UserAgent
38+
echo "Updating pkg/client/configuration.go..."
39+
sed "s/UserAgent: \"ccloud-sdk-go\/[^\"]*\"/UserAgent: \"ccloud-sdk-go\/$VERSION\"/" pkg/client/configuration.go > pkg/client/configuration.go.tmp && mv pkg/client/configuration.go.tmp pkg/client/configuration.go
40+
41+
echo "Version updated to $VERSION"

0 commit comments

Comments
 (0)