chore:update goreleaser and Makefile

This commit is contained in:
KaySar12 2024-10-04 11:23:28 +07:00
parent db526c2796
commit a5e21b3c28
2 changed files with 99 additions and 87 deletions

View File

@ -1,6 +1,6 @@
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com
project_name: casaos-user-service
project_name: nextzen-user-service
before:
hooks:
- go generate
@ -8,7 +8,7 @@ before:
- go mod tidy
- go test -race -v ./...
builds:
- id: casaos-user-service-amd64
- id: nextzen-user-service-amd64
binary: build/sysroot/usr/bin/casaos-user-service
hooks:
post:
@ -29,7 +29,7 @@ builds:
- linux
goarch:
- amd64
- id: casaos-user-service-arm64
- id: nextzen-user-service-arm64
binary: build/sysroot/usr/bin/casaos-user-service
# hooks:
# post:
@ -50,7 +50,7 @@ builds:
- linux
goarch:
- arm64
- id: casaos-user-service-arm-7
- id: nextzen-user-service-arm-7
binary: build/sysroot/usr/bin/casaos-user-service
hooks:
post:
@ -73,74 +73,74 @@ builds:
- arm
goarm:
- "7"
- id: casaos-user-service-migration-tool-amd64
binary: build/sysroot/usr/bin/casaos-user-service-migration-tool
hooks:
post:
- upx --best --lzma -v --no-progress "{{ .Path }}"
main: ./cmd/migration-tool
env:
- CC=x86_64-linux-gnu-gcc
ldflags:
- -X main.commit={{.Commit}}
- -X main.date={{.Date}}
- -s
- -w
- -extldflags "-static"
tags:
- musl
- netgo
- osusergo
goos:
- linux
goarch:
- amd64
- id: casaos-user-service-migration-tool-arm64
binary: build/sysroot/usr/bin/casaos-user-service-migration-tool
# hooks:
# post:
# - upx --best --lzma -v --no-progress "{{ .Path }}"
main: ./cmd/migration-tool
env:
- CC=aarch64-linux-gnu-gcc
ldflags:
- -X main.commit={{.Commit}}
- -X main.date={{.Date}}
- -s
- -w
- -extldflags "-static"
tags:
- musl
- netgo
- osusergo
goos:
- linux
goarch:
- arm64
- id: casaos-user-service-migration-tool-arm-7
binary: build/sysroot/usr/bin/casaos-user-service-migration-tool
hooks:
post:
- upx --best --lzma -v --no-progress "{{ .Path }}"
main: ./cmd/migration-tool
env:
- CC=arm-linux-gnueabihf-gcc
ldflags:
- -X main.commit={{.Commit}}
- -X main.date={{.Date}}
- -s
- -w
- -extldflags "-static"
tags:
- musl
- netgo
- osusergo
goos:
- linux
goarch:
- arm
goarm:
- "7"
# - id: casaos-user-service-migration-tool-amd64
# binary: build/sysroot/usr/bin/casaos-user-service-migration-tool
# hooks:
# post:
# - upx --best --lzma -v --no-progress "{{ .Path }}"
# main: ./cmd/migration-tool
# env:
# - CC=x86_64-linux-gnu-gcc
# ldflags:
# - -X main.commit={{.Commit}}
# - -X main.date={{.Date}}
# - -s
# - -w
# - -extldflags "-static"
# tags:
# - musl
# - netgo
# - osusergo
# goos:
# - linux
# goarch:
# - amd64
# - id: casaos-user-service-migration-tool-arm64
# binary: build/sysroot/usr/bin/casaos-user-service-migration-tool
# # hooks:
# # post:
# # - upx --best --lzma -v --no-progress "{{ .Path }}"
# main: ./cmd/migration-tool
# env:
# - CC=aarch64-linux-gnu-gcc
# ldflags:
# - -X main.commit={{.Commit}}
# - -X main.date={{.Date}}
# - -s
# - -w
# - -extldflags "-static"
# tags:
# - musl
# - netgo
# - osusergo
# goos:
# - linux
# goarch:
# - arm64
# - id: casaos-user-service-migration-tool-arm-7
# binary: build/sysroot/usr/bin/casaos-user-service-migration-tool
# hooks:
# post:
# - upx --best --lzma -v --no-progress "{{ .Path }}"
# main: ./cmd/migration-tool
# env:
# - CC=arm-linux-gnueabihf-gcc
# ldflags:
# - -X main.commit={{.Commit}}
# - -X main.date={{.Date}}
# - -s
# - -w
# - -extldflags "-static"
# tags:
# - musl
# - netgo
# - osusergo
# goos:
# - linux
# goarch:
# - arm
# goarm:
# - "7"
archives:
- name_template: >-
{{ .Os }}-{{- if eq .Arch "arm" }}arm-7{{- else }}{{ .Arch }}{{- end }}-{{ .ProjectName }}-v{{ .Version }}
@ -150,15 +150,15 @@ archives:
- casaos-user-service-arm-7
files:
- build/**/*
- name_template: >-
{{ .Os }}-{{- if eq .Arch "arm" }}arm-7{{- else }}{{ .Arch }}{{- end }}-{{ .ProjectName }}-migration-tool-v{{ .Version }}
id: casaos-user-service-migration-tool
builds:
- casaos-user-service-migration-tool-amd64
- casaos-user-service-migration-tool-arm64
- casaos-user-service-migration-tool-arm-7
files:
- build/sysroot/etc/**/*
# - name_template: >-
# {{ .Os }}-{{- if eq .Arch "arm" }}arm-7{{- else }}{{ .Arch }}{{- end }}-{{ .ProjectName }}-migration-tool-v{{ .Version }}
# id: casaos-user-service-migration-tool
# builds:
# - casaos-user-service-migration-tool-amd64
# - casaos-user-service-migration-tool-arm64
# - casaos-user-service-migration-tool-arm-7
# files:
# - build/sysroot/etc/**/*
checksum:
name_template: "checksums.txt"
snapshot:
@ -171,8 +171,8 @@ changelog:
- "^test:"
release:
github:
owner: IceWhaleTech
name: CasaOS-UserService
owner: KaySar12
name: NextZen-UserService
draft: true
prerelease: auto
mode: replace

View File

@ -1,5 +1,7 @@
GORELEASER=goreleaser
GORELEASERBUILD=$(GORELEASER) build
GIT=git
GIT_REMOTE=origin
SERVICE = casaos-user-service
ARCHITECHTURE= amd64
OS=linux
@ -7,10 +9,10 @@ VERSION=v1
BIN_PATH=build/sysroot/usr/bin
BUILD_PATH=build
CUR_DIR=$(PWD)
TAG=v1.4.0
CURTAG=v1.4.0
ARCHIVE_PATH=buildzip
PACKAGE_NAME=$(OS)-$(ARCHITECHTURE)-nextzenos-user-service-$(TAG)
TAG_MESSAGE=test
build_service:
$(GORELEASERBUILD) --clean --snapshot -f .goreleaser.debug.yaml --id $(SERVICE)-$(ARCHITECHTURE)
@ -19,8 +21,18 @@ package:
&& tar -czvf $(PACKAGE_NAME).tar.gz $(CUR_DIR)/$(BUILD_PATH)
archive_package:
mv $(PACKAGE_NAME).tar.gz $(CUR_DIR)/$(ARCHIVE_PATH)
@mkdir -p $(CUR_DIR)/$(ARCHIVE_PATH)/$(CURTAG)
@mv $(PACKAGE_NAME).tar.gz $(CUR_DIR)/$(ARCHIVE_PATH)/$(CURTAG)/
remove_package:
rm $(PACKAGE_NAME).tar.gz
clear_archive:
rm -rf $(CUR_DIR)/$(ARCHIVE_PATH)/*
@rm -rf $(CUR_DIR)/$(ARCHIVE_PATH)
create_release:
@${GIT} push ${GIT_REMOTE}
@${GIT} tag -a ${CURTAG} -m "${TAG_MESSAGE}" || { echo "Failed to create tag"; exit 1; }
@${GIT} push ${GIT_REMOTE} ${CURTAG} || { echo "Failed to push tag"; exit 1; }
@export GORELEASER_PREVIOUS_TAG=${PREVTAG}
push_release_multi:
${GORELEASER} release --clean
push_release:
${GORELEASER} release --clean