Skip to content

Commit 5348c2e

Browse files
committed
[CI/CD] Enhancement.
1. change rpm/deb version of Development Release set 'latest' dev-release version as v$major.$minor.${patch+1}rc 2. set version number into overlaybd-snapshotter & convertor Signed-off-by: Yifan Yuan <[email protected]>
1 parent 69b3995 commit 5348c2e

File tree

5 files changed

+23
-3
lines changed

5 files changed

+23
-3
lines changed

.github/workflows/release.yml

+13-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,19 @@ jobs:
3636
RELEASE_VERSION=${{ env.RELEASE_VERSION }}
3737
if [[ -z ${RELEASE_VERSION} ]]; then
3838
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
4052
fi
4153
echo "RELEASE_VERSION=${RELEASE_VERSION}"
4254
RELEASE_NUM="$(date +%Y%m%d%H%M%S).$(git rev-parse --short HEAD)"

.github/workflows/release/Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ ARG RELEASE_VERSION
3030
ENV SEMVER=${RELEASE_VERSION}
3131
ARG RELEASE_NUM
3232
ENV RELEASE=${RELEASE_NUM}
33+
ENV COMMIT_ID="${RELEASE_VERSION}_${RELEASE_NUM}"
3334
RUN make && \
3435
nfpm pkg --packager deb --target /tmp/ && \
3536
nfpm pkg --packager rpm --target /tmp/

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ force:
1919
# build a binary from cmd
2020
bin/%: cmd/% force
2121
@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 $@ ./$<
2323

2424
install: ## install binaries from bin
2525
@mkdir -p $(SN_DESTDIR)

ci/build_image/Dockerfile

+3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ ENV GOOS=${TARGETOS}
2929
ENV GOARCH=${TARGETARCH}
3030
ARG RELEASE_VERSION
3131
ENV SEMVER=${RELEASE_VERSION}
32+
ARG RELEASE_NUM
33+
ENV RELEASE=${RELEASE_NUM}
34+
ENV COMMIT_ID="${RELEASE_VERSION}_${RELEASE_NUM}"
3235
RUN make && \
3336
nfpm pkg --packager deb --target /tmp/ && \
3437
nfpm pkg --packager rpm --target /tmp/

cmd/convertor/main.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import (
3131
)
3232

3333
var (
34+
commitID string = "unknown"
3435
repo string
3536
user string
3637
plain bool
@@ -61,7 +62,10 @@ var (
6162
rootCmd = &cobra.Command{
6263
Use: "convertor",
6364
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,
6569
Run: func(cmd *cobra.Command, args []string) {
6670
if verbose {
6771
logrus.SetLevel(logrus.DebugLevel)

0 commit comments

Comments
 (0)