Skip to content

Commit e7bebae

Browse files
committed
Inject production OAuth client ID+secret into release
1 parent 8deaf21 commit e7bebae

File tree

4 files changed

+11
-0
lines changed

4 files changed

+11
-0
lines changed

.github/workflows/releases.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ jobs:
2222
version: latest
2323
args: release
2424
env:
25+
GH_OAUTH_CLIENT_ID: 178c6fc778ccc68e1d6a
26+
GH_OAUTH_CLIENT_SECRET: ${{secrets.OAUTH_CLIENT_SECRET}}
2527
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
2628
- name: Copy release
2729
id: copy

.goreleaser.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ builds:
77
- binary: bin/gh
88
ldflags:
99
- -s -w -X github.com/github/gh-cli/command.Version={{.Version}} -X github.com/github/gh-cli/command.BuildDate={{.Date}}
10+
- -X github.com/github/gh-cli/context.oauthClientID={{.Env.GH_OAUTH_CLIENT_ID}}
11+
- -X github.com/github/gh-cli/context.oauthClientSecret={{.Env.GH_OAUTH_CLIENT_SECRET}}
1012
goos:
1113
- linux
1214
- darwin

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ BUILD_FILES = $(shell go list -f '{{range .GoFiles}}{{$$.Dir}}/{{.}}\
44
GH_VERSION = $(shell go describe --tags 2>/dev/null || git rev-parse --short HEAD)
55
LDFLAGS := -X github.com/github/gh-cli/command.Version=$(GH_VERSION) $(LDFLAGS)
66
LDFLAGS := -X github.com/github/gh-cli/command.BuildDate=$(shell date +%Y-%m-%d) $(LDFLAGS)
7+
ifdef GH_OAUTH_CLIENT_SECRET
8+
LDFLAGS := -X github.com/github/gh-cli/context.oauthClientID=$(GH_OAUTH_CLIENT_ID) $(LDFLAGS)
9+
LDFLAGS := -X github.com/github/gh-cli/context.oauthClientSecret=$(GH_OAUTH_CLIENT_SECRET) $(LDFLAGS)
10+
endif
711

812
bin/gh: $(BUILD_FILES)
913
@go build -ldflags "$(LDFLAGS)" -o "$@"

context/config_setup.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ import (
1414

1515
const (
1616
oauthHost = "github.com"
17+
)
18+
19+
var (
1720
// The GitHub app that is meant for development
1821
oauthClientID = "4d747ba5675d5d66553f"
1922
// This value is safe to be embedded in version control

0 commit comments

Comments
 (0)