diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 43e765b0..e4946560 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - - name: Setup Go 1.21.x + - name: Setup Go uses: actions/setup-go@v4 with: go-version: '1.20' diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 00000000..99147410 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,32 @@ +name: release +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' + +permissions: + contents: write + +jobs: + release: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + fetch-depth: 0 + - run: git fetch --force --tags + - uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 + with: + go-version: '1.20.0' + # Ensure generation tools run + - name: build + run: | + OUT_FILE=/tmp/localidp make build + - name: GoReleaser + uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0 + id: run-goreleaser + with: + version: latest + args: release --clean --timeout 30m + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 00000000..2817ca77 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,33 @@ +project_name: localidp + +before: + hooks: + - go mod tidy +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - darwin + goarch: + - amd64 + - arm64 + binary: localidp + ignore: + - goos: linux + goarch: '386' +archives: + - format: tar.gz + name_template: >- + {{ .ProjectName }}-{{ .Os }}-{{ .Arch }} +checksum: + name_template: 'checksums.txt' +snapshot: + name_template: "{{ incpatch .Version }}-next" +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' + diff --git a/Makefile b/Makefile index e348bde3..4d0bb625 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,10 @@ + +# The name of the binary. Defaults to localidp +OUT_FILE ?= localidp + .PHONY: build build: manifests generate fmt vet - go build -o idpbuilder main.go + go build -o $(OUT_FILE) main.go # ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary. ENVTEST_K8S_VERSION = 1.27.1