From 9eb15c99b43aa97c42b55d4be8c86fe7048bd0b9 Mon Sep 17 00:00:00 2001 From: Karl Cardenas Date: Sun, 30 Jun 2024 10:16:43 -0700 Subject: [PATCH] fix: added login flow --- .github/workflows/release.yml | 11 +++++++++++ .goreleaser.yaml | 10 +++++++++- cmd/login.go | 4 ++-- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0d5aa24..0176e14 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,6 +14,7 @@ permissions: env: SVU_VERSION: "2.0.1" GO_VERSION: "1.22" + UPX_VERSION: "4.2.4" jobs: tag: @@ -41,6 +42,7 @@ jobs: tar -xzf svu.tar.gz chmod +x svu sudo mv svu /usr/local/bin/ + svu --version - id: tag run: | @@ -87,6 +89,15 @@ jobs: with: go-version: ${{ env.GO_VERSION }} check-latest: true + + - name: Get UPX + run: | + URL="https://github.com/upx/upx/releases/download/v${UPX_VERSION}/upx-${UPX_VERSION}-amd64_linux.tar.xz" + wget --quiet $URL --output-document upx.tar.xz + tar -xJf upx.tar.xz + chmod +x upx + sudo mv upx /usr/local/bin/ + upx --version - uses: goreleaser/goreleaser-action@v6 with: diff --git a/.goreleaser.yaml b/.goreleaser.yaml index b77b149..0b38739 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -31,7 +31,13 @@ builds: - arm64 goarm: - '6' - - '7' + - '7' +upx: + - + enabled: true + compress: best + goos: [linux, darwin] + archives: - format: zip @@ -59,3 +65,5 @@ changelog: exclude: - "^docs:" - "^test:" + +report_sizes: true \ No newline at end of file diff --git a/cmd/login.go b/cmd/login.go index 222351d..d8fb5a9 100644 --- a/cmd/login.go +++ b/cmd/login.go @@ -97,7 +97,7 @@ func login() error { TokenURL: internal.DEFAULT_ACCESS_TOKEN_URL, }, } - slog.Info("Redirect Config", "URL:", "http://localhost:"+port+redirectURL) + slog.Debug("Redirect Config", "URL:", "http://localhost:"+port+redirectURL) authUrl := internal.GetAuthURL(*config) if authUrl == "" { @@ -218,7 +218,7 @@ func closeHandler(w http.ResponseWriter, r *http.Request) { if err != nil { slog.Error("unable to write response", "error", err) } - os.Exit(0) + defer os.Exit(0) } // openBrowser opens a browser to the specified URL