chore: get HEAD commit when version is missing tag (#777)

Also, add more instructions to `bug_report.yml` on how to find
the ddns-go version.
This commit is contained in:
WaterLemons2k 2023-07-20 21:45:23 +08:00 committed by GitHub
parent 68c59d0fb7
commit b486804b50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -71,7 +71,7 @@ body:
- type: input
attributes:
label: 版本
description: ddns-go 的版本或 commit,可运行 `ddns-go -v` 查看版本
description: ddns-go 的版本或 commit(可在网页右上角找到,或运行 `ddns-go -v` 查看版本)
placeholder: v0.0.1
validations:
required: true

View File

@ -1,6 +1,7 @@
.PHONY: build clean test test-race
VERSION=$(shell git describe --tags `git rev-list --tags --max-count=1`)
# 如果找不到 tag 则使用 HEAD commit
VERSION=$(shell git describe --tags `git rev-list --tags --max-count=1` 2>/dev/null || git rev-parse --short HEAD)
BUILD_TIME=$(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
BIN=ddns-go
DIR_SRC=.