File tree 5 files changed +23
-3
lines changed
5 files changed +23
-3
lines changed Original file line number Diff line number Diff line change 36
36
RELEASE_VERSION=${{ env.RELEASE_VERSION }}
37
37
if [[ -z ${RELEASE_VERSION} ]]; then
38
38
git fetch --tags
39
- RELEASE_VERSION=$(git tag --sort=v:refname -l v* | tail -1)
39
+ RELEASE_VERSION=$(git tag --sort=v:refname -l v* | tail -1) #v1.1.3
40
+ version="${RELEASE_VERSION#v}"
41
+
42
+ IFS='.' read -ra version_parts <<< "$version"
43
+
44
+ major_version=${version_parts[0]}
45
+ minor_version=${version_parts[1]}
46
+ patch_version=${version_parts[2]}
47
+
48
+ ((patch_version++))
49
+
50
+ new_version="$major_version.$minor_version.$patch_version"
51
+ RELEASE_VERSION="${new_version}rc" #1.1.4rc
40
52
fi
41
53
echo "RELEASE_VERSION=${RELEASE_VERSION}"
42
54
RELEASE_NUM="$(date +%Y%m%d%H%M%S).$(git rev-parse --short HEAD)"
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ ARG RELEASE_VERSION
30
30
ENV SEMVER=${RELEASE_VERSION}
31
31
ARG RELEASE_NUM
32
32
ENV RELEASE=${RELEASE_NUM}
33
+ ENV COMMIT_ID="${RELEASE_VERSION}_${RELEASE_NUM}"
33
34
RUN make && \
34
35
nfpm pkg --packager deb --target /tmp/ && \
35
36
nfpm pkg --packager rpm --target /tmp/
Original file line number Diff line number Diff line change 19
19
# build a binary from cmd
20
20
bin/% : cmd/% force
21
21
@echo " $@ "
22
- @GOOS=linux CGO_ENABLED=0 go build -ldflags " -X 'main.commitID=$$ (git rev-parse --short HEAD) '" -o $@ ./$<
22
+ @GOOS=linux CGO_ENABLED=0 go build -ldflags " -X 'main.commitID=$$ COMMIT_ID '" -o $@ ./$<
23
23
24
24
install : # # install binaries from bin
25
25
@mkdir -p $(SN_DESTDIR )
Original file line number Diff line number Diff line change @@ -29,6 +29,9 @@ ENV GOOS=${TARGETOS}
29
29
ENV GOARCH=${TARGETARCH}
30
30
ARG RELEASE_VERSION
31
31
ENV SEMVER=${RELEASE_VERSION}
32
+ ARG RELEASE_NUM
33
+ ENV RELEASE=${RELEASE_NUM}
34
+ ENV COMMIT_ID="${RELEASE_VERSION}_${RELEASE_NUM}"
32
35
RUN make && \
33
36
nfpm pkg --packager deb --target /tmp/ && \
34
37
nfpm pkg --packager rpm --target /tmp/
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ import (
31
31
)
32
32
33
33
var (
34
+ commitID string = "unknown"
34
35
repo string
35
36
user string
36
37
plain bool
61
62
rootCmd = & cobra.Command {
62
63
Use : "convertor" ,
63
64
Short : "An image conversion tool from oci image to overlaybd image." ,
64
- Long : "overlaybd convertor is a standalone userspace image conversion tool that helps converting oci images to overlaybd images" ,
65
+ Long : `
66
+ Description: overlaybd convertor is a standalone userspace image conversion tool that helps converting oci images to overlaybd images.
67
+
68
+ Version: ` + commitID ,
65
69
Run : func (cmd * cobra.Command , args []string ) {
66
70
if verbose {
67
71
logrus .SetLevel (logrus .DebugLevel )
You can’t perform that action at this time.
0 commit comments