diff options
| author | Ruben Beltran del Rio <git@r.bdr.sh> | 2025-02-08 22:09:18 +0100 |
|---|---|---|
| committer | Ruben Beltran del Rio <git@r.bdr.sh> | 2025-02-08 22:09:18 +0100 |
| commit | bba6c1d8736573eb0526c4d27d9a4f9cd634c66e (patch) | |
| tree | 0fc96ed71f436112a80ae348c6bd21b3c421c3b1 | |
| parent | 4b8569d2d79b40c73ced3deca91733a9fa1d835f (diff) | |
Optionally use file to allow local signing
| -rw-r--r-- | .build.yml | 1 | ||||
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | Makefile | 13 | ||||
| -rwxr-xr-x | scripts/read_minisign_password.sh | 4 | ||||
| -rwxr-xr-x | scripts/sign.sh | 18 |
5 files changed, 25 insertions, 12 deletions
@@ -34,5 +34,4 @@ tasks: echo 'rustflags = ["-C", "link-arg=-fuse-ld=lld"]' >> .cargo/config.toml - package: | cd page - ./scripts/read_minisign_password.sh make ci @@ -3,3 +3,4 @@ *.tar.gz *.tar.gz.sha256 +*.minisig @@ -6,10 +6,9 @@ deploy_host := deploy@conchos.unlimited.pizza deploy_path := /srv/http/build.r.bdr.sh/$(app_name) define sign_and_deploy - sha256sum $(1) > $(1).sha256 - echo "$MINISIGN_PASSWORD" | minisign -Sm $(1) - rsync -avz $(1) $(DEPLOY_HOST):$(DEPLOY_PATH) - rsync -avz $(1).minisig $(DEPLOY_HOST):$(DEPLOY_PATH) + @./scripts/sign.sh "$(1)" "$(channel)" "$(architecture)" + rsync -avz $(1) $(deploy_host):$(deploy_path) + rsync -avz $(1).minisig $(deploy_host):$(deploy_path) endef default: build @@ -50,7 +49,7 @@ ifeq ($(findstring linux,$(target)),linux) @$(eval filename := $(app_name)-$(target)-$(channel)) cargo deb --profile $(profile) --target $(target) mv target/$(target)/debian/*.deb $(filename).deb - @$(call checksum_and_deploy,$(filename).deb) + @$(call sign_and_deploy,$(filename).deb) endif rpm: build @@ -58,13 +57,13 @@ ifeq ($(findstring linux,$(target)),linux) @$(eval filename := $(app_name)-$(target)-$(channel)) cargo generate-rpm --profile $(profile) --target $(target) mv target/$(target)/generate-rpm/*.rpm $(filename).rpm - @$(call checksum_and_deploy,$(filename).rpm) + @$(call sign_and_deploy,$(filename).rpm) endif tar: build @$(eval filename := $(app_name)-$(target)-$(channel)) tar -czvf $(filename).tar.gz -C target/$(target)/$(profile)/ $(app_name) - @$(call checksum_and_deploy,$(filename).tar.gz) + @$(call sign_and_deploy,$(filename).tar.gz) package: $(architectures) diff --git a/scripts/read_minisign_password.sh b/scripts/read_minisign_password.sh deleted file mode 100755 index c4bfd66..0000000 --- a/scripts/read_minisign_password.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -set +x -export MINISIGN_PASSWORD=$(cat ~/.minisign/minisign.pass) diff --git a/scripts/sign.sh b/scripts/sign.sh new file mode 100755 index 0000000..b3bfe47 --- /dev/null +++ b/scripts/sign.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +set +x +if [ $# -ne 3 ]; then + echo "Usage: $0 <file> <channel> <architecture>" + exit 1 +fi + +FILE="$1" +VERSION="$2" +PLATFORM="$3" +COMMENT="Version: ${VERSION}, File: $(basename ${FILE}) Built on: $(date +'%Y-%m-%d %H:%M'), Platform: ${PLATFORM}" + +if [ -f ~/.minisign/minisign.pass ]; then + cat ~/.minisign/minisign.pass | minisign -Sm "${FILE}" -t "${COMMENT}" +else + minisign -Sm "${FILE}" -t "${COMMENT}" +fi |