From bf6a75d1f5ccf3c183f15fe9424f170572b9d874 Mon Sep 17 00:00:00 2001 From: SP-JohannT Date: Fri, 24 May 2024 08:26:41 +0200 Subject: [PATCH] feat: add custom release mechanism --- .github/workflows/securepoint-release.yml | 32 +++++++++++++++++++++++ .goreleaser.yml | 11 ++++++++ main.go | 2 +- oauthproxy.go | 2 +- version.go | 4 +-- 5 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/securepoint-release.yml create mode 100644 .goreleaser.yml diff --git a/.github/workflows/securepoint-release.yml b/.github/workflows/securepoint-release.yml new file mode 100644 index 0000000000..d523e15874 --- /dev/null +++ b/.github/workflows/securepoint-release.yml @@ -0,0 +1,32 @@ +name: Release + +on: + push: + tags: + - v* + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + id: go + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v5 + with: + version: latest + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000000..33f9cdad5c --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,11 @@ +project_name: oauth2-proxy +builds: +- env: + - CGO_ENABLED=0 + binary: oauth2-proxy + goos: + - linux + - darwin + goarch: + - amd64 + - arm64 \ No newline at end of file diff --git a/main.go b/main.go index 5694e94e33..c46d99e252 100644 --- a/main.go +++ b/main.go @@ -28,7 +28,7 @@ func main() { configFlagSet.Parse(os.Args[1:]) if *showVersion { - fmt.Printf("oauth2-proxy %s (built with %s)\n", VERSION, runtime.Version()) + fmt.Printf("oauth2-proxy %s (built with %s)\n", version, runtime.Version()) return } diff --git a/oauthproxy.go b/oauthproxy.go index 82aef70e6a..8f3bfbd9e8 100644 --- a/oauthproxy.go +++ b/oauthproxy.go @@ -142,7 +142,7 @@ func NewOAuthProxy(opts *options.Options, validator func(string) bool) (*OAuthPr CustomLogo: opts.Templates.CustomLogo, ProxyPrefix: opts.ProxyPrefix, Footer: opts.Templates.Footer, - Version: VERSION, + Version: version, Debug: opts.Templates.Debug, ProviderName: buildProviderName(provider, opts.Providers[0].Name), SignInMessage: buildSignInMessage(opts), diff --git a/version.go b/version.go index d6fa19b961..c199c8edd9 100644 --- a/version.go +++ b/version.go @@ -1,4 +1,4 @@ package main -// VERSION contains version information -var VERSION = "undefined" +// version contains version information +var version = "undefined"