mirror of
https://git.mills.io/prologic/zs
synced 2024-11-21 21:06:10 +03:00
Add release script
This commit is contained in:
parent
3644a88f46
commit
da3aeb9bb2
25
.goreleaser.yml
Normal file
25
.goreleaser.yml
Normal file
@ -0,0 +1,25 @@
|
||||
---
|
||||
builds:
|
||||
-
|
||||
id: zs
|
||||
binary: zs
|
||||
main: .
|
||||
flags: -tags "static_build"
|
||||
ldflags: -w -X main.Version={{.Version}} -X main.Commit={{.Commit}}
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
goos:
|
||||
- darwin
|
||||
- linux
|
||||
goarch:
|
||||
- amd64
|
||||
- arm64
|
||||
signs:
|
||||
- artifacts: checksum
|
||||
release:
|
||||
gitea:
|
||||
owner: prologic
|
||||
name: zs
|
||||
draft: true
|
||||
gitea_urls:
|
||||
api: https://git.mills.io/api/v1/
|
25
tools/release.sh
Executable file
25
tools/release.sh
Executable file
@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Get the highest tag number
|
||||
VERSION="$(git describe --abbrev=0 --tags)"
|
||||
VERSION=${VERSION:-'0.0.0'}
|
||||
|
||||
# Get number parts
|
||||
MAJOR="${VERSION%%.*}"; VERSION="${VERSION#*.}"
|
||||
MINOR="${VERSION%%.*}"; VERSION="${VERSION#*.}"
|
||||
PATCH="${VERSION%%.*}"; VERSION="${VERSION#*.}"
|
||||
|
||||
# Increase version
|
||||
PATCH=$((PATCH+1))
|
||||
|
||||
TAG="${1}"
|
||||
|
||||
if [ "${TAG}" = "" ]; then
|
||||
TAG="${MAJOR}.${MINOR}.${PATCH}"
|
||||
fi
|
||||
|
||||
echo "Releasing ${TAG} ..."
|
||||
|
||||
git tag -a -s -m "Release ${TAG}" "${TAG}"
|
||||
git push --tags
|
||||
goreleaser release --rm-dist
|
18
version.go
Normal file
18
version.go
Normal file
@ -0,0 +1,18 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
var (
|
||||
// Version release version
|
||||
Version = "0.0.1"
|
||||
|
||||
// Commit will be overwritten automatically by the build system
|
||||
Commit = "HEAD"
|
||||
)
|
||||
|
||||
// FullVersion display the full version and build
|
||||
func FullVersion() string {
|
||||
return fmt.Sprintf("%s@%s", Version, Commit)
|
||||
}
|
Loading…
Reference in New Issue
Block a user