File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change 6363 GOARCH : ${{ matrix.goarch }}
6464 CGO_ENABLED : 0
6565 DISCORD_CLIENT_ID : ${{ secrets.DISCORD_CLIENT_ID }}
66- run : go build -ldflags="-s -w" -o ${{ matrix.name }} .
66+ run : |
67+ go build \
68+ -ldflags="-s -w -X 'main.DefaultClientID=${{ secrets.DISCORD_CLIENT_ID }}'" \
69+ -o ${{ matrix.name }} .
6770
6871 - name : Upload artifacts
6972 uses : actions/upload-artifact@v4
Original file line number Diff line number Diff line change @@ -13,6 +13,9 @@ import (
1313 "time"
1414)
1515
16+ // will be set during build via ldflags
17+ var DefaultClientID = "PLACEHOLDER_CLIENT_ID"
18+
1619// Discord RPC message types
1720const (
1821 OpHandshake = iota
@@ -170,6 +173,11 @@ func getClientID() string {
170173 return clientID
171174 }
172175
176+ // For CI, this will be done via Github Actions and with ldflags
177+ if DefaultClientID != "" && DefaultClientID != "PLACEHOLDER_CLIENT_ID" {
178+ return DefaultClientID
179+ }
180+
173181 // For Running Locally
174182 fmt .Println ("No Discord Client ID available!" )
175183 fmt .Println ()
You can’t perform that action at this time.
0 commit comments