File tree Expand file tree Collapse file tree 6 files changed +29
-11
lines changed Expand file tree Collapse file tree 6 files changed +29
-11
lines changed Original file line number Diff line number Diff line change 24
24
next_version : ${{ github.event.inputs.release_version }}
25
25
package_name : mackerel-check-plugins
26
26
version_go_file_path : mackerel-check.go
27
-
28
- - run : |
29
- CURRENT=${{ steps.start.outputs.currentVersion }}
30
- NEXT=${{ steps.start.outputs.nextVersion }}
31
- mv packaging/mackerel-check-plugins_$CURRENT.orig.tar.gz packaging/mackerel-check-plugins_$NEXT.orig.tar.gz
27
+ ignore_update_program_files : " true"
32
28
33
29
- uses : mackerelio/mackerel-create-release-pull-request-action@main
34
30
with :
Original file line number Diff line number Diff line change 55
55
with :
56
56
go-version : 1.23.x
57
57
- uses : actions/checkout@v4
58
+ with :
59
+ fetch-depth : 0
58
60
- run : make clean build rpm deb
59
61
- uses : actions/upload-artifact@v4
60
62
with :
Original file line number Diff line number Diff line change 6
6
! .travis.yml
7
7
/build
8
8
check- * /check- *
9
+ packaging /* .deb
Original file line number Diff line number Diff line change 1
- VERSION = 0.48.0
2
- CURRENT_REVISION = $(shell git rev-parse --short HEAD )
1
+ # This VERSION variable indicates the latest tag.
2
+ VERSION = $(subst v,, $( shell git describe --abbrev=0 --tags) )
3
3
ifeq ($(OS ) ,Windows_NT)
4
4
GOPATH_ROOT: =$(shell cygpath ${GOPATH})
5
5
else
40
40
# We need to force rebuild "mackerel-check" if GOOS or GOARCH are passed.
41
41
build/mackerel-check : $(patsubst % ,depends_on,$(GOOS )$(GOARCH ) )
42
42
mkdir -p build
43
- CGO_ENABLED=0 go build -ldflags=" -s -w -X main.gitcommit= $( CURRENT_REVISION ) " \
43
+ CGO_ENABLED=0 go build -ldflags=" -s -w" \
44
44
-o build/mackerel-check
45
45
46
46
.PHONY : depends_on
@@ -78,14 +78,18 @@ deb: deb-v2-x86 deb-v2-arm
78
78
79
79
.PHONY : deb-v2-x86
80
80
deb-v2-x86 :
81
+ git clean -f -d ./packaging
81
82
make build/mackerel-check GOOS=linux GOARCH=amd64
82
83
cp build/mackerel-check packaging/deb-v2/debian/
84
+ cp -f packaging/dummy-empty.tar.gz packaging/mackerel-check-plugins_${VERSION} .orig.tar.gz
83
85
cd packaging/deb-v2 && debuild --no-tgz-check -rfakeroot -uc -us
84
86
85
87
.PHONY : deb-v2-arm
86
88
deb-v2-arm :
89
+ git clean -f -d ./packaging
87
90
make build/mackerel-check GOOS=linux GOARCH=arm64
88
91
cp build/mackerel-check packaging/deb-v2/debian/
92
+ cp -f packaging/dummy-empty.tar.gz packaging/mackerel-check-plugins_${VERSION} .orig.tar.gz
89
93
cd packaging/deb-v2 && debuild --no-tgz-check -rfakeroot -uc -us -aarm64
90
94
91
95
.PHONY : clean
Original file line number Diff line number Diff line change 8
8
"path/filepath"
9
9
"regexp"
10
10
"runtime"
11
+ "runtime/debug"
11
12
"strings"
12
13
)
13
14
@@ -60,11 +61,25 @@ func run(args []string) int {
60
61
return exitOK
61
62
}
62
63
63
- const version = "0.48.0"
64
-
65
- var gitcommit string
64
+ func fromVCS () (version , rev string ) {
65
+ version = "unknown"
66
+ rev = "unknown"
67
+ info , ok := debug .ReadBuildInfo ()
68
+ if ! ok {
69
+ return
70
+ }
71
+ version = info .Main .Version
72
+ for _ , s := range info .Settings {
73
+ if s .Key == "vcs.revision" {
74
+ rev = s .Value
75
+ return
76
+ }
77
+ }
78
+ return
79
+ }
66
80
67
81
func printHelp () {
82
+ version , gitcommit := fromVCS ()
68
83
fmt .Printf (`mackerel-check %s (rev %s) [%s %s %s]
69
84
70
85
Usage: mackerel-check <plugin> [<args>]
File renamed without changes.
You can’t perform that action at this time.
0 commit comments