From 9eb8b08a69e8b1c699c9c07a06c1ff8e5f6ad0fe Mon Sep 17 00:00:00 2001 From: techknowlogick Date: Sat, 18 Mar 2023 01:58:21 -0400 Subject: [PATCH] checksum and compress --- .goreleaser.checksum.sh | 12 ++++++++++++ .goreleaser.yaml | 23 +++++++++++++++++------ 2 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 .goreleaser.checksum.sh diff --git a/.goreleaser.checksum.sh b/.goreleaser.checksum.sh new file mode 100644 index 0000000..a11b71d --- /dev/null +++ b/.goreleaser.checksum.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +set -e + +if [ -z "$1" ]; then + echo "usage: $0 " + exit 1 +fi + +SUM=$(shasum -a 256 "$1" | cut -d' ' -f1) +BASENAME=$(basename "$1") +echo -n "${SUM} ${BASENAME}" > "$1".sha256 \ No newline at end of file diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 64f9465..2533b2f 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -14,8 +14,6 @@ builds: - amd64 - arm - arm64 -# - s390x -# - ppc64le goarm: - "5" - "6" @@ -63,8 +61,7 @@ builds: - -s -w -X gitea.com/gitea/act_runner/cmd.version={{ .Version }} binary: >- {{ .ProjectName }}- - {{- if .IsSnapshot }}{{ .Branch }}- - {{- else }}{{- .Version }}-{{ end }} + {{- .Version }}- {{- .Os }}- {{- if eq .Arch "amd64" }}amd64 {{- else if eq .Arch "amd64_v1" }}amd64 @@ -72,6 +69,13 @@ builds: {{- else }}{{ .Arch }}{{ end }} {{- if .Arm }}-{{ .Arm }}{{ end }} no_unique_dist_dir: true + hooks: + post: + - cmd: tar -cJf {{ .Path }}.xz {{ .Path }} + env: + - XZ_OPT=-9 + - cmd: sh .goreleaser.checksum.sh {{ .Path }} + - cmd: sh .goreleaser.checksum.sh {{ .Path }}.xz blobs: - @@ -79,6 +83,9 @@ blobs: bucket: "{{ .Env.S3_BUCKET }}" region: "{{ .Env.S3_REGION }}" folder: "act_runner/{{.Version}}" + extra_files: + - glob: ./**.xz + - glob: ./**.sha256 archives: - format: binary @@ -87,10 +94,14 @@ archives: checksum: name_template: 'checksums.txt' + extra_files: + - glob: ./**.xz snapshot: - name_template: "{{ incpatch .Version }}" + name_template: "{{ .Branch }}-devel" nightly: - publish_release: false name_template: "{{ .Branch }}" + +# yaml-language-server: $schema=https://goreleaser.com/static/schema-pro.json +# vim: set ts=2 sw=2 tw=0 fo=cnqoj \ No newline at end of file