diff --git a/.goreleaser.yml b/.config/goreleaser.yaml similarity index 87% rename from .goreleaser.yml rename to .config/goreleaser.yaml index 45fc36b39..5339c2bf2 100644 --- a/.goreleaser.yml +++ b/.config/goreleaser.yaml @@ -1,3 +1,4 @@ +version: 2 project_name: kured before: hooks: @@ -23,10 +24,10 @@ builds: - -trimpath snapshot: - name_template: "{{ .ShortCommit }}" + version_template: "{{ .ShortCommit }}" release: disable: true changelog: - skip: true + disable: true diff --git a/.mise/config.toml b/.config/mise.toml similarity index 84% rename from .mise/config.toml rename to .config/mise.toml index 9ab907290..b98451bdf 100644 --- a/.mise/config.toml +++ b/.config/mise.toml @@ -1,7 +1,7 @@ [tools] cosign = "2.2.3" golangci-lint = "2.1.6" -goreleaser = "1.24.0" +goreleaser = "2.13.1" kind = "0.30.0" kubectl = "1.31.0" shellcheck = "0.11.0" diff --git a/.github/workflows/on-pr-goreleaser.yaml b/.github/workflows/on-pr-goreleaser.yaml new file mode 100644 index 000000000..bce823cc4 --- /dev/null +++ b/.github/workflows/on-pr-goreleaser.yaml @@ -0,0 +1,28 @@ +name: Verify GoReleaser config +on: + pull_request: + paths: + - '.config/goreleaser.yaml' + push: + paths: + - '.config/goreleaser.yaml' + +jobs: + check-goreleaser-config: + name: Check GoReleaser config + runs-on: ubuntu-latest + steps: + - name: Harden Runner + uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0 + with: + egress-policy: audit + + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + + - name: Check GoReleaser config + uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a #v6.4.0 + with: + version: '~> v2' + args: check + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 70fec707c..97c789ff1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -40,7 +40,7 @@ Your system needs at least the following binaries installed: ### Fetch the additional binaries required Please run `make install-tools` once on a fresh repository clone to download necessary developer tools. -Installed tools are listed in [.mise directory](.mise/config.toml). +Installed tools are listed in [.mise directory](.config/mise.toml). ### Configure your git for the "Certificate of Origin" @@ -94,7 +94,7 @@ We also have other tests: All these tests are run on every PR/tagged release. See [.github/workflows](.github/workflows) for more details. -We use [GoReleaser to build](.goreleaser.yml). +We use [GoReleaser to build](.config/goreleaser.yaml). ## Regular development activities / maintenance diff --git a/Dockerfile b/Dockerfile index dcdcbc889..4d174ce46 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,20 +4,21 @@ ARG TARGETOS ARG TARGETARCH ARG TARGETVARIANT +RUN apk update --no-cache && apk add --no-cache jq + COPY dist/ /dist + +# Fetch binary directory from artifacts.json RUN set -ex \ && case "${TARGETARCH}" in \ - amd64) \ - SUFFIX="_v1" \ - ;; \ arm) \ - SUFFIX="_${TARGETVARIANT:1}" \ + BINARY_PATH=$(jq -r 'first(.[] | select(.goos == "linux" and .type == "Binary" and .goarch == "arm" and .goarm == env.TARGETVARIANT[1:] ) | .path)' /dist/artifacts.json) \ ;; \ *) \ - SUFFIX="" \ + BINARY_PATH=$(jq -r 'first(.[] | select(.goos == "linux" and .type == "Binary" and .goarch == env.TARGETARCH) | .path)' /dist/artifacts.json) \ ;; \ esac \ - && cp /dist/kured_${TARGETOS}_${TARGETARCH}${SUFFIX}/kured /dist/kured; + && cp /${BINARY_PATH} /dist/kured; FROM alpine:3.22.2@sha256:4b7ce07002c69e8f3d704a9c5d6fd3053be500b7f1c69fc0d80990c2ad8dd412 RUN apk update --no-cache && apk upgrade --no-cache && apk add --no-cache ca-certificates tzdata diff --git a/Makefile b/Makefile index 1ef091b59..7596258d2 100644 --- a/Makefile +++ b/Makefile @@ -69,4 +69,8 @@ lint: lint-docs: @echo "Running lychee" - mise x lychee@latest -- lychee --verbose --no-progress '*.md' '*.yaml' '*/*/*.go' --exclude-link-local \ No newline at end of file + mise x lychee@latest -- lychee --verbose --no-progress '*.md' '*.yaml' '*/*/*.go' --exclude-link-local + +lint-goreleaser: + @echo "Checking goreleaser" + goreleaser check \ No newline at end of file