From b486804b5068a944792772b999a63bd59efd88f6 Mon Sep 17 00:00:00 2001 From: WaterLemons2k <62788816+WaterLemons2k@users.noreply.github.com> Date: Thu, 20 Jul 2023 21:45:23 +0800 Subject: [PATCH] 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. --- .github/ISSUE_TEMPLATE/bug_report.yml | 2 +- Makefile | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 7424549..ae84978 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -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 diff --git a/Makefile b/Makefile index 4ec863b..09d5c30 100644 --- a/Makefile +++ b/Makefile @@ -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=.