diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6513026..fadd6ba 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,7 +21,7 @@ jobs: - name: Setup test environment run: | - go build -tags testsetup -o test-setup ./cmd/test-setup + go build -tags encoder_setup -o test-setup ./cmd/test-setup ./test-setup - name: Run tests diff --git a/.goreleaser.yml b/.goreleaser.yml index 88777bb..fd4ac4f 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -5,6 +5,17 @@ release: github: owner: belphemur name: CBZOptimizer + ids: + - cbzoptimizer +archives: + - ids: + - cbzoptimizer + formats: ["tar.zst"] + format_overrides: + - # Which GOOS to override the format for. + goos: windows + formats: ["zip"] # Plural form, multiple formats. Since: v2.6 + changelog: sort: asc filters: @@ -44,6 +55,25 @@ builds: - -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{ .CommitDate }} env: - CGO_ENABLED=0 + - id: encoder-setup + main: cmd/encoder-setup/main.go + binary: encoder-setup + goos: + - linux + goarch: + - amd64 + - arm64 + # ensures mod timestamp to be the commit timestamp + mod_timestamp: "{{ .CommitTimestamp }}" + flags: + # trims path + - -trimpath + tags: + - encoder_setup + ldflags: + - -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{ .CommitDate }} + env: + - CGO_ENABLED=0 # config the checksum filename # https://goreleaser.com/customization/checksum checksum: @@ -71,6 +101,7 @@ dockers_v2: - id: cbzoptimizer-image ids: - cbzoptimizer + - encoder-setup platforms: - linux/amd64 - linux/arm64 @@ -90,7 +121,7 @@ dockers_v2: # all files (including the sboms) are included in the checksum, so we don't need to sign each one if we don't want to # https://goreleaser.com/customization/sign signs: - - cmd: cosign + - cmd: cosign-windows-amd64.exe env: - COSIGN_EXPERIMENTAL=1 certificate: "${artifact}.pem" @@ -105,7 +136,7 @@ signs: # signs our docker image # https://goreleaser.com/customization/docker_sign docker_signs: - - cmd: cosign + - cmd: cosign-windows-amd64.exe env: - COSIGN_EXPERIMENTAL=1 output: true diff --git a/Dockerfile b/Dockerfile index 11f4ff4..f30aef6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,9 @@ ENV CONFIG_FOLDER=/config ENV PUID=99 ENV DEBIAN_FRONTEND=noninteractive -RUN apt-get update && apt-get install -y --no-install-recommends adduser && \ +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ + --mount=type=cache,target=/var/lib/apt,sharing=locked \ + apt-get update && apt-get install -y --no-install-recommends adduser && \ addgroup --system users && \ adduser \ --system \ @@ -21,7 +23,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends adduser && \ COPY ${TARGETPLATFORM}/CBZOptimizer ${APP_PATH} -RUN apt-get update && \ +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ + --mount=type=cache,target=/var/lib/apt,sharing=locked \ + --mount=type=bind,source=${TARGETPLATFORM},target=/tmp/target \ + apt-get update && \ apt-get full-upgrade -y && \ apt-get install -y --no-install-recommends \ inotify-tools \ @@ -29,6 +34,7 @@ RUN apt-get update && \ ca-certificates \ bash-completion && \ rm -rf /var/lib/apt/lists/* && \ + /tmp/target/encoder-setup && \ chmod +x ${APP_PATH} && \ ${APP_PATH} completion bash > /etc/bash_completion.d/CBZOptimizer.bash diff --git a/cmd/test-setup/main.go b/cmd/encoder-setup/main.go similarity index 86% rename from cmd/test-setup/main.go rename to cmd/encoder-setup/main.go index 575b276..93e56eb 100644 --- a/cmd/test-setup/main.go +++ b/cmd/encoder-setup/main.go @@ -1,5 +1,5 @@ -//go:build testsetup -// +build testsetup +//go:build encoder_setup +// +build encoder_setup package main