Skip to content

Commit b89d38d

Browse files
authored
fix: v9 module path release workflow (#559)
1 parent f5be3a7 commit b89d38d

38 files changed

Lines changed: 74 additions & 74 deletions

.github/workflows/release-please.yml

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,40 @@ jobs:
4040
ref: ${{ fromJSON(steps.release.outputs.pr).headBranchName }}
4141
token: ${{ steps.app-token.outputs.token }}
4242

43+
# Go modules require the module path and all import statements to
44+
# include the major version (e.g. /v7). release-please doesn't handle
45+
# this, so when a release PR bumps the major version we automatically
46+
# rewrite go.mod, imports, and READMEs on the release PR branch.
47+
- name: Migrate Go module path for major version bump
48+
if: steps.release.outputs.pr
49+
run: |
50+
CURRENT_MAJOR=$(grep -oP 'module github\.com/workos/workos-go/v\K[0-9]+' go.mod)
51+
NEW_VERSION=$(jq -r '."."' .release-please-manifest.json)
52+
NEW_MAJOR="${NEW_VERSION%%.*}"
53+
54+
if [ "$CURRENT_MAJOR" = "$NEW_MAJOR" ]; then
55+
echo "No major version change ($CURRENT_MAJOR → $NEW_MAJOR), skipping"
56+
exit 0
57+
fi
58+
59+
echo "Major version bump detected: v$CURRENT_MAJOR → v$NEW_MAJOR"
60+
61+
sed -i "s|module github.com/workos/workos-go/v${CURRENT_MAJOR}|module github.com/workos/workos-go/v${NEW_MAJOR}|" go.mod
62+
find . -name '*.go' -not -path './.git/*' -type f \
63+
-exec sed -i "s|github.com/workos/workos-go/v${CURRENT_MAJOR}|github.com/workos/workos-go/v${NEW_MAJOR}|g" {} +
64+
find . -name 'README.md' -not -path './.git/*' -type f \
65+
-exec sed -i "s|workos-go/v${CURRENT_MAJOR}|workos-go/v${NEW_MAJOR}|g" {} +
66+
67+
git config user.name "workos-sdk-automation[bot]"
68+
git config user.email "255426317+workos-sdk-automation[bot]@users.noreply.github.com"
69+
git add -A
70+
if git diff --staged --quiet; then
71+
echo "No changes to commit"
72+
else
73+
git commit -m "chore: update go.mod and import paths for v${NEW_MAJOR}"
74+
git push
75+
fi
76+
4377
# Inline pending changelog fragments under the version heading
4478
# release-please just wrote in CHANGELOG.md. For PRs that have a
4579
# fragment (the autogen flow always writes one), drop the line
@@ -129,40 +163,6 @@ jobs:
129163
git commit -m "chore: inline release notes from .changelog-pending"
130164
git push
131165
132-
# Go modules require the module path and all import statements to
133-
# include the major version (e.g. /v7). release-please doesn't handle
134-
# this, so when a release PR bumps the major version we automatically
135-
# rewrite go.mod, imports, and READMEs on the release PR branch.
136-
- name: Migrate Go module path for major version bump
137-
if: steps.release.outputs.pr
138-
run: |
139-
CURRENT_MAJOR=$(grep -oP 'module github\.com/workos/workos-go/v\K[0-9]+' go.mod)
140-
NEW_VERSION=$(jq -r '."."' .release-please-manifest.json)
141-
NEW_MAJOR="${NEW_VERSION%%.*}"
142-
143-
if [ "$CURRENT_MAJOR" = "$NEW_MAJOR" ]; then
144-
echo "No major version change ($CURRENT_MAJOR → $NEW_MAJOR), skipping"
145-
exit 0
146-
fi
147-
148-
echo "Major version bump detected: v$CURRENT_MAJOR → v$NEW_MAJOR"
149-
150-
sed -i "s|module github.com/workos/workos-go/v${CURRENT_MAJOR}|module github.com/workos/workos-go/v${NEW_MAJOR}|" go.mod
151-
find . -name '*.go' -not -path './.git/*' -type f \
152-
-exec sed -i "s|github.com/workos/workos-go/v${CURRENT_MAJOR}|github.com/workos/workos-go/v${NEW_MAJOR}|g" {} +
153-
find . -name 'README.md' -not -path './.git/*' -type f \
154-
-exec sed -i "s|workos-go/v${CURRENT_MAJOR}|workos-go/v${NEW_MAJOR}|g" {} +
155-
156-
git config user.name "workos-sdk-automation[bot]"
157-
git config user.email "255426317+workos-sdk-automation[bot]@users.noreply.github.com"
158-
git add -A
159-
if git diff --staged --quiet; then
160-
echo "No changes to commit"
161-
else
162-
git commit -m "chore: update go.mod and import paths for v${NEW_MAJOR}"
163-
git push
164-
fi
165-
166166
# Detect when a release-please release PR has merged, then tag and
167167
# create the GitHub Release whose body is extracted from CHANGELOG.md
168168
# (now rich, after the inline step above). Runs on every push to main;

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# WorkOS Go Library
44

5-
[![Go Reference](https://pkg.go.dev/badge/github.com/workos/workos-go/v8.svg)](https://pkg.go.dev/github.com/workos/workos-go/v8)
5+
[![Go Reference](https://pkg.go.dev/badge/github.com/workos/workos-go/v9.svg)](https://pkg.go.dev/github.com/workos/workos-go/v9)
66

77
The WorkOS Go library provides a flat, root-level `workos` package for applications written in Go.
88

@@ -11,7 +11,7 @@ The WorkOS Go library provides a flat, root-level `workos` package for applicati
1111
Requires Go `1.23+`.
1212

1313
```bash
14-
go get github.com/workos/workos-go/v8
14+
go get github.com/workos/workos-go/v9
1515
```
1616

1717
## Usage
@@ -23,7 +23,7 @@ import (
2323
"context"
2424
"log"
2525

26-
"github.com/workos/workos-go/v8"
26+
"github.com/workos/workos-go/v9"
2727
)
2828

2929
func main() {
@@ -210,5 +210,5 @@ This SDK is a Go library that uses a flat package layout at the module root rath
210210
Import the root package:
211211

212212
```go
213-
import "github.com/workos/workos-go/v8"
213+
import "github.com/workos/workos-go/v9"
214214
```

actions_helper_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"time"
1515

1616
"github.com/stretchr/testify/require"
17-
"github.com/workos/workos-go/v8"
17+
"github.com/workos/workos-go/v9"
1818
)
1919

2020
const testActionSecret = "action_secret_key"

admin_portal_test.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api_keys_test.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

audit_logs_test.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

authkit_helpers_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
"testing"
1313

1414
"github.com/stretchr/testify/require"
15-
"github.com/workos/workos-go/v8"
15+
"github.com/workos/workos-go/v9"
1616
)
1717

1818
func TestGetAuthKitAuthorizationURL_BuildsCorrectURL(t *testing.T) {

authorization_test.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"time"
1212

1313
"github.com/stretchr/testify/require"
14-
"github.com/workos/workos-go/v8"
14+
"github.com/workos/workos-go/v9"
1515
)
1616

1717
func TestClient_UserAgentIncludesVersion(t *testing.T) {

connect_test.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)