Skip to content

Commit e3829f7

Browse files
stainless-app[bot]batuhan
authored andcommitted
fix: improved workflow for developing on branches
1 parent 3d52897 commit e3829f7

8 files changed

Lines changed: 73 additions & 23 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Setup Go
2+
description: 'Sets up Go environment with private modules'
3+
inputs:
4+
stainless-api-key:
5+
required: true
6+
description: the value of the STAINLESS_API_KEY secret
7+
runs:
8+
using: composite
9+
steps:
10+
- uses: stainless-api/retrieve-github-access-token@v1
11+
id: get_token
12+
with:
13+
repo: stainless-sdks/beeper-desktop-api-go
14+
stainless-api-key: ${{ inputs.stainless-api-key }}
15+
16+
- name: Configure Git for access to the Go SDK's staging repo
17+
shell: bash
18+
run: git config --global url."https://x-access-token:${{ steps.get_token.outputs.github_access_token }}@github.com/stainless-sdks/beeper-desktop-api-go".insteadOf "https://github.com/stainless-sdks/beeper-desktop-api-go"
19+
20+
- name: Setup go
21+
uses: actions/setup-go@v5
22+
with:
23+
go-version-file: ./go.mod
24+
25+
- name: Bootstrap
26+
shell: bash
27+
run: ./scripts/bootstrap

.github/workflows/ci.yml

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ on:
1212
- 'stl-preview-head/**'
1313
- 'stl-preview-base/**'
1414

15+
env:
16+
GOPRIVATE: github.com/beeper/desktop-api-go,github.com/stainless-sdks/beeper-desktop-api-go
17+
1518
jobs:
1619
lint:
1720
timeout-minutes: 10
@@ -22,10 +25,14 @@ jobs:
2225
steps:
2326
- uses: actions/checkout@v6
2427

25-
- name: Setup go
26-
uses: actions/setup-go@v5
28+
- uses: ./.github/actions/setup-go
2729
with:
28-
go-version-file: ./go.mod
30+
stainless-api-key: ${{ secrets.STAINLESS_API_KEY }}
31+
32+
- name: Link staging branch
33+
if: github.repository == 'stainless-sdks/beeper-desktop-api-cli'
34+
run: |
35+
./scripts/link 'github.com/stainless-sdks/beeper-desktop-api-go@${{ github.ref_name }}'
2936
3037
- name: Bootstrap
3138
run: ./scripts/bootstrap
@@ -44,10 +51,14 @@ jobs:
4451
steps:
4552
- uses: actions/checkout@v6
4653

47-
- name: Setup go
48-
uses: actions/setup-go@v5
54+
- uses: ./.github/actions/setup-go
4955
with:
50-
go-version-file: ./go.mod
56+
stainless-api-key: ${{ secrets.STAINLESS_API_KEY }}
57+
58+
- name: Link staging branch
59+
if: github.repository == 'stainless-sdks/beeper-desktop-api-cli'
60+
run: |
61+
./scripts/link 'github.com/stainless-sdks/beeper-desktop-api-go@${{ github.ref_name }}'
5162
5263
- name: Bootstrap
5364
run: ./scripts/bootstrap
@@ -87,10 +98,14 @@ jobs:
8798
steps:
8899
- uses: actions/checkout@v6
89100

90-
- name: Setup go
91-
uses: actions/setup-go@v5
101+
- uses: ./.github/actions/setup-go
92102
with:
93-
go-version-file: ./go.mod
103+
stainless-api-key: ${{ secrets.STAINLESS_API_KEY }}
104+
105+
- name: Link staging branch
106+
if: github.repository == 'stainless-sdks/beeper-desktop-api-cli'
107+
run: |
108+
./scripts/link 'github.com/stainless-sdks/beeper-desktop-api-go@${{ github.ref_name }}'
94109
95110
- name: Bootstrap
96111
run: ./scripts/bootstrap

scripts/bootstrap

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,5 @@ if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "$SKIP_BREW" != "1" ]
1818
echo
1919
}
2020
fi
21-
2221
echo "==> Installing Go dependencies…"
23-
go mod tidy
22+
go mod tidy -e || true

scripts/build

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
#!/usr/bin/env bash
22

3-
set -e
3+
set -euo pipefail
44

55
cd "$(dirname "$0")/.."
66

7+
# Mark the necessary Go modules as private to avoid Go's proxy
8+
export GOPRIVATE="${GOPRIVATE:+$GOPRIVATE,}github.com/beeper/desktop-api-go,github.com/stainless-sdks/beeper-desktop-api-go"
9+
710
echo "==> Building beeper-desktop-cli"
811
go build ./cmd/beeper-desktop-cli

scripts/link

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
#!/usr/bin/env bash
22

3-
set -e
3+
set -euo pipefail
44

55
cd "$(dirname "$0")/.."
66

7-
if [[ -n "$1" ]]; then
8-
LOCAL_GO="$1"
9-
shift
10-
else
11-
LOCAL_GO=../beeperdesktop-go
12-
fi
7+
# Mark the necessary Go modules as private to avoid Go's proxy
8+
export GOPRIVATE="${GOPRIVATE:+$GOPRIVATE,}github.com/beeper/desktop-api-go,github.com/stainless-sdks/beeper-desktop-api-go"
139

14-
echo "==> Linking with local directory"
10+
REPLACEMENT="${1:-"../beeperdesktop-go"}"
11+
echo "==> Replacing Go SDK with $REPLACEMENT"
12+
go mod edit -replace github.com/beeper/desktop-api-go="$REPLACEMENT"
1513
go mod tidy -e
16-
go mod edit -replace github.com/beeper/desktop-api-go="$LOCAL_GO"

scripts/lint

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
#!/usr/bin/env bash
22

3-
set -e
3+
set -euo pipefail
44

55
cd "$(dirname "$0")/.."
66

7+
# Mark the necessary Go modules as private to avoid Go's proxy
8+
export GOPRIVATE="${GOPRIVATE:+$GOPRIVATE,}github.com/beeper/desktop-api-go,github.com/stainless-sdks/beeper-desktop-api-go"
9+
710
echo "==> Running Go build"
811
go build ./...

scripts/run

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
#!/usr/bin/env bash
22

3-
set -e
3+
set -euo pipefail
44

55
cd "$(dirname "$0")/.."
66

7+
# Mark the necessary Go modules as private to avoid Go's proxy
8+
export GOPRIVATE="${GOPRIVATE:+$GOPRIVATE,}github.com/beeper/desktop-api-go,github.com/stainless-sdks/beeper-desktop-api-go"
9+
710
go run ./cmd/beeper-desktop-cli "$@"

scripts/test

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ set -euo pipefail
44

55
cd "$(dirname "$0")/.."
66

7+
# Mark the necessary Go modules as private to avoid Go's proxy
8+
export GOPRIVATE="${GOPRIVATE:+$GOPRIVATE,}github.com/beeper/desktop-api-go,github.com/stainless-sdks/beeper-desktop-api-go"
9+
710
RED='\033[0;31m'
811
GREEN='\033[0;32m'
912
YELLOW='\033[0;33m'

0 commit comments

Comments
 (0)