no message

This commit is contained in:
Roee Gadot
2021-06-19 09:40:19 +03:00
parent 605c67c22f
commit 3567f5c00b
4 changed files with 20 additions and 18 deletions

View File

@@ -2,8 +2,9 @@ name: public-cli
on:
push:
branches:
- 'develop'
- 'main'
- 'my-temp-release-check'
# - 'develop'
# - 'main'
jobs:
docker:
runs-on: ubuntu-latest
@@ -15,20 +16,28 @@ jobs:
with:
service_account_key: ${{ secrets.GCR_JSON_KEY }}
export_default_credentials: true
- name: Auto Increment Semver Action
uses: MCKanpolat/auto-semver-action@1.0.5
id: versioning
with:
releaseType: patch # TODO: should be by branch master=minor other=patch
incrementPerCommit: false
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Get base image name
shell: bash
run: |
echo "##[set-output name=cal_ver;]$(echo $(date +'%y.%m.%d'))"
echo "##[set-output name=build_time_utc;]$(echo $(date -u))"
echo "##[set-output name=build_timestamp;]$(echo $(date +%s))"
echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: version_parameters
- name: Build and Push CLI
run: make push-cli CAL_VER='${{ steps.version_parameters.outputs.cal_ver }}' BUILD_TIME_UTC='${{ steps.version_parameters.outputs.build_time_utc }}' BUILD_TIMESTAMP='${{ steps.version_parameters.outputs.build_timestamp }}'
run: make push-cli SEM_VER='${{ steps.versioning.outputs.version }}' BUILD_TIME_UTC='${{ steps.version_parameters.outputs.build_time_utc }}' BUILD_TIMESTAMP='${{ steps.version_parameters.outputs.build_timestamp }}'
- if: github.ref == 'refs/heads/main'
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "cli/bin/*"
commit: ${{ steps.version_parameters.outputs.branch }}
tag: ${{ steps.version_parameters.outputs.cal_ver }}
tag: ${{ steps.version_parameters.outputs.version }}

View File

@@ -5,14 +5,6 @@ GIT_VERSION=$(shell git branch --show-current | tr '[:upper:]' '[:lower:]')
BUILD_TIMESTAMP=$(shell date +%s)
BUILD_TIME_UTC=$(shell date -u)
ifeq ($(GIT_BRANCH), master)
# SECONDS_SINCE_START_OF_DAY=$(shell echo $(( $(date -u '+%-H * 3600 + %-M * 60 + %-S') ))) # TODO: in case we do more than once a day
CAL_VER=$(shell date +'%y.%m.%d')
else
CAL_VER=$(shell date +'%y.%m.%d.%H.%M.%S')
endif
.PHONY: help
.DEFAULT_GOAL := help
@@ -25,9 +17,9 @@ install:
build: ## build mizu CLI binary (select platform via GOOS / GOARCH env variables)
go build -ldflags="-X 'github.com/up9inc/mizu/cli/mizu.GitCommitHash=$(COMMIT_HASH)' \
-X 'github.com/up9inc/mizu/cli/mizu.Branch=$(GIT_BRANCH)' \
-X 'github.com/up9inc/mizu/cli/mizu.CalVer=$(CAL_VER)' \
-X 'github.com/up9inc/mizu/cli/mizu.BuildTimestamp=$(BUILD_TIMESTAMP)' \
-X 'github.com/up9inc/mizu/cli/mizu.BuildTimeUTC=$(BUILD_TIME_UTC)'" \
-X 'github.com/up9inc/mizu/cli/mizu.BuildTimeUTC=$(BUILD_TIME_UTC)' \
-X 'github.com/up9inc/mizu/cli/mizu.SemVer=$(SEM_VER)'" \
-o bin/mizu_$(FOLDER) mizu.go
build-all: ## build for all supported platforms

View File

@@ -19,10 +19,11 @@ var versionCmd = &cobra.Command{
Short: "Print version info",
RunE: func(cmd *cobra.Command, args []string) error {
if mizuVersionOptions.DebugInfo {
fmt.Printf("Version: %s \nBranch: %s (%s) \n", mizu.CalVer, mizu.Branch, mizu.GitCommitHash)
fmt.Printf("Version: %s \nBranch: %s (%s) \n", mizu.SemVer, mizu.Branch, mizu.GitCommitHash)
fmt.Printf("Build Time: %s (%s)\n", mizu.BuildTimestamp, mizu.BuildTimeUTC)
} else {
fmt.Printf("Version: %s (%s)\n", mizu.CalVer, mizu.Branch)
fmt.Printf("Version: %s (%s)\n", mizu.SemVer, mizu.Branch)
}
return nil
},

View File

@@ -1,7 +1,7 @@
package mizu
var (
CalVer = "yy.MM.DD.HH.mm.ss" // this var is overridden using ldflags in makefile when building
SemVer = "0.0.1"
Branch = "develop"
GitCommitHash = "" // this var is overridden using ldflags in makefile when building
BuildTimeUTC = "" // this var is overridden using ldflags in makefile when building