Inject production OAuth client ID+secret into release
This commit is contained in:
parent
8deaf21520
commit
e7bebaeebc
4 changed files with 11 additions and 0 deletions
2
.github/workflows/releases.yml
vendored
2
.github/workflows/releases.yml
vendored
|
|
@ -22,6 +22,8 @@ jobs:
|
|||
version: latest
|
||||
args: release
|
||||
env:
|
||||
GH_OAUTH_CLIENT_ID: 178c6fc778ccc68e1d6a
|
||||
GH_OAUTH_CLIENT_SECRET: ${{secrets.OAUTH_CLIENT_SECRET}}
|
||||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
||||
- name: Copy release
|
||||
id: copy
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ builds:
|
|||
- binary: bin/gh
|
||||
ldflags:
|
||||
- -s -w -X github.com/github/gh-cli/command.Version={{.Version}} -X github.com/github/gh-cli/command.BuildDate={{.Date}}
|
||||
- -X github.com/github/gh-cli/context.oauthClientID={{.Env.GH_OAUTH_CLIENT_ID}}
|
||||
- -X github.com/github/gh-cli/context.oauthClientSecret={{.Env.GH_OAUTH_CLIENT_SECRET}}
|
||||
goos:
|
||||
- linux
|
||||
- darwin
|
||||
|
|
|
|||
4
Makefile
4
Makefile
|
|
@ -4,6 +4,10 @@ BUILD_FILES = $(shell go list -f '{{range .GoFiles}}{{$$.Dir}}/{{.}}\
|
|||
GH_VERSION = $(shell go describe --tags 2>/dev/null || git rev-parse --short HEAD)
|
||||
LDFLAGS := -X github.com/github/gh-cli/command.Version=$(GH_VERSION) $(LDFLAGS)
|
||||
LDFLAGS := -X github.com/github/gh-cli/command.BuildDate=$(shell date +%Y-%m-%d) $(LDFLAGS)
|
||||
ifdef GH_OAUTH_CLIENT_SECRET
|
||||
LDFLAGS := -X github.com/github/gh-cli/context.oauthClientID=$(GH_OAUTH_CLIENT_ID) $(LDFLAGS)
|
||||
LDFLAGS := -X github.com/github/gh-cli/context.oauthClientSecret=$(GH_OAUTH_CLIENT_SECRET) $(LDFLAGS)
|
||||
endif
|
||||
|
||||
bin/gh: $(BUILD_FILES)
|
||||
@go build -ldflags "$(LDFLAGS)" -o "$@"
|
||||
|
|
|
|||
|
|
@ -14,6 +14,9 @@ import (
|
|||
|
||||
const (
|
||||
oauthHost = "github.com"
|
||||
)
|
||||
|
||||
var (
|
||||
// The GitHub app that is meant for development
|
||||
oauthClientID = "4d747ba5675d5d66553f"
|
||||
// This value is safe to be embedded in version control
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue