refactor: remove commented build steps and add checksum script for binaries

This commit is contained in:
2025-01-21 13:18:21 -06:00
parent f54150c3d2
commit 4721373f67
3 changed files with 71 additions and 20 deletions

View File

@@ -33,26 +33,6 @@ jobs:
- name: Test
run: go test -race -v -shuffle=on ./...
# - name: Build for linux
# run: |
# go build -o bin/SteamCache2-${VERSION#v}-${BUILD}-${GOOS}-${GOARCH} main.go
# env:
# VERSION: ${{github.ref_name}}
# BUILD: ${{github.run_number}}
# GOOS: linux
# GOARCH: amd64
# EXE: ""
# - name: Build for windows
# run: |
# go build -o bin/SteamCache2-${VERSION#v}-${BUILD}-${GOOS}-${GOARCH} main.go
# env:
# VERSION: ${{github.ref_name}}
# BUILD: ${{github.run_number}}
# GOOS: windows
# GOARCH: amd64
# EXE: ".exe"
- name: Release binaries
uses: goreleaser/goreleaser-action@v6
with:

12
.goreleaser.checksum.sh Normal file
View File

@@ -0,0 +1,12 @@
#!/bin/bash
set -e
if [ -z "$1" ]; then
echo "usage: $0 <path>"
exit 1
fi
SUM=$(shasum -a 256 "$1" | cut -d' ' -f1)
BASENAME=$(basename "$1")
echo -n "${SUM} ${BASENAME}" > "$1".sha256

59
.goreleaser.yaml Normal file
View File

@@ -0,0 +1,59 @@
before:
hooks:
- go mod tidy
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
goarch:
- amd64
flags:
- -trimpath
ldflags:
- -s -w -X main.Version={{ .Version }}
binary: >-
{{ .ProjectName }}-
{{- .Version }}-
{{- .Os }}-
{{- if eq .Arch "amd64" }}amd64
{{- else if eq .Arch "amd64_v1" }}amd64
{{- else if eq .Arch "386" }}386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}-{{ .Arm }}{{ end }}
no_unique_dist_dir: true
hooks:
post:
- cmd: xz -k -9 {{ .Path }}
dir: ./dist/
- cmd: sh .goreleaser.checksum.sh {{ .Path }}
- cmd: sh .goreleaser.checksum.sh {{ .Path }}.xz
archives:
- format: binary
name_template: "{{ .Binary }}"
allow_different_binary_count: true
checksum:
name_template: 'checksums.txt'
extra_files:
- glob: ./**.xz
force_token: gitea
snapshot:
name_template: "{{ .Branch }}-devel"
nightly:
name_template: "{{ .Branch }}"
gitea_urls:
api: https://gitea.s1d3sw1ped.com/api/v1
download: https://gitea.s1d3sw1ped.com
release:
extra_files:
- glob: ./**.xz
- glob: ./**.xz.sha256