Skip to content

Commit

Permalink
fix: second try to fixup clientID missing
Browse files Browse the repository at this point in the history
  • Loading branch information
slurdge committed Jan 6, 2024
1 parent 491a691 commit 5c778dc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,13 @@ jobs:
echo "GIT_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
- name: Build
env:
IMGUR_CLIENT_ID: ${{ secrets.IMGUR_CLIENT_ID }}
run: >-
python3 gox.py
-osarch="linux/386 linux/amd64 linux/arm linux/arm64 darwin/amd64 darwin/arm64 windows/amd64 windows/386"
-output "build/{{.Dir}}_{{.OS}}_{{.Arch}}"
-ldflags "-w -s -X github.com/slurdge/goeland/version.GitCommit=${{ env.GIT_COMMIT }} -X github.com/slurdge/goeland/version.BuildDate=${{ env.BUILD_DATE }} -X github.com/slurdge/goeland/internal/goeland/fetch.clientID=${{ secrets.IMGUR_CLIENT_ID }}"
-ldflags "-w -s -X github.com/slurdge/goeland/version.GitCommit=$GIT_COMMIT -X github.com/slurdge/goeland/version.BuildDate=$BUILD_DATE -X github.com/slurdge/goeland/internal/goeland/fetch.clientID=$IMGUR_CLIENT_ID"
# Commented out because
# MacOS seems unsupported
Expand All @@ -68,3 +70,9 @@ jobs:
append_body: true
files: |
./build/*
- name: Archive build
uses: actions/upload-artifact@v3
with:
name: Build
path: build
2 changes: 1 addition & 1 deletion build_all.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ FOR /F "tokens=* USEBACKQ" %%F IN (`git rev-parse HEAD`) DO (SET GIT_COMMIT=%%F)
FOR /F "tokens=* USEBACKQ" %%F IN (`powershell get-date -format "{yyyyMMddHHmmss}"`) DO (SET BUILD_DATE=%%F)
FOR /F "tokens=* USEBACKQ" %%F IN (`type clientid.txt`) DO (SET CLIENT_ID=%%F)
del /s /q build\*.*
python gox.py -osarch="linux/386 linux/amd64 linux/arm64 linux/arm darwin/amd64 darwin/arm64 windows/amd64 windows/386" -parallel 4 -output "build/{{.Dir}}_{{.OS}}_{{.Arch}}" -ldflags "-X github.com/slurdge/goeland/goeland.clientID=%CLIENT_ID% -X github.com/slurdge/goeland/version.GitCommit=%GIT_COMMIT% -X github.com/slurdge/goeland/version.BuildDate=%BUILD_DATE% -s -w"
python gox.py -osarch="linux/386 linux/amd64 linux/arm64 linux/arm darwin/amd64 darwin/arm64 windows/amd64 windows/386" -parallel 4 -output "build/{{.Dir}}_{{.OS}}_{{.Arch}}" -ldflags "-X github.com/slurdge/goeland/internal/goeland/fetch.clientID=%CLIENT_ID% -X github.com/slurdge/goeland/version.GitCommit=%GIT_COMMIT% -X github.com/slurdge/goeland/version.BuildDate=%BUILD_DATE% -s -w"
5 changes: 5 additions & 0 deletions internal/goeland/fetch/imgur.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"time"

"github.com/slurdge/goeland/internal/goeland"
"github.com/slurdge/goeland/log"
"github.com/spf13/viper"
)

Expand Down Expand Up @@ -51,6 +52,10 @@ func fetchImgurTag(source *goeland.Source, tag string, sort string) error {
clientID = config.GetString("imgur-cid")
}

if clientID == "" {
log.Warnln("Imgur may fail: clientID is empty")
}

req.Header.Set("Authorization", "Client-ID "+clientID)

res, err := client.Do(req)
Expand Down

0 comments on commit 5c778dc

Please sign in to comment.