From 711f27949f3766c78796d4b7d243edecf0704900 Mon Sep 17 00:00:00 2001 From: Mikhail Grigorev Date: Tue, 23 Apr 2024 17:45:49 +0500 Subject: [PATCH] Revert Makefile and workflow --- .github/workflows/default.yml | 12 ------------ Makefile | 32 +++++--------------------------- 2 files changed, 5 insertions(+), 39 deletions(-) diff --git a/.github/workflows/default.yml b/.github/workflows/default.yml index a729e4b..c938635 100644 --- a/.github/workflows/default.yml +++ b/.github/workflows/default.yml @@ -32,15 +32,3 @@ jobs: - name: Run test run: make test - build: - runs-on: ubuntu-latest - needs: test - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Log in to Docker Hub - run: docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build image - run: make docker-build-branch diff --git a/Makefile b/Makefile index 1081484..11f8479 100644 --- a/Makefile +++ b/Makefile @@ -1,30 +1,13 @@ DOCKER_ACCOUNT = cherts APPNAME = pgscv APPOS = linux -APPOS = ${GOOS} - -TAG_COMMIT := $(shell git rev-list --abbrev-commit --tags --max-count=1) -TAG := $(shell git describe --abbrev=0 --tags ${TAG_COMMIT} 2>/dev/null || true) -COMMIT := $(shell git rev-parse --short HEAD) -DATE := $(shell git log -1 --format=%cd --date=format:"%Y%m%d") -ifeq ($(TAG),) - VERSION := 0.8 -else - #VERSION := $(TAG:v%=%) - VERSION := $(TAG) -endif -ifneq ($(COMMIT), $(TAG_COMMIT)) - VERSION := $(VERSION)-next-$(DATE) -endif -ifeq ($(VERSION),) - VERSION := $(COMMIT)-$(DATA) -endif -ifneq ($(shell git status --porcelain),) - VERSION := $(VERSION)-dirty -endif +#APPOS = ${GOOS} + +TAG=$(shell git tag -l --sort=-creatordate | head -n 1) +COMMIT=$(shell git rev-parse --short HEAD) BRANCH=$(shell git rev-parse --abbrev-ref HEAD) -LDFLAGS = -a -installsuffix cgo -ldflags "-X main.appName=${APPNAME} -X main.gitTag=${VERSION} -X main.gitCommit=${COMMIT} -X main.gitBranch=${BRANCH}" +LDFLAGS = -a -installsuffix cgo -ldflags "-X main.appName=${APPNAME} -X main.gitTag=${TAG} -X main.gitCommit=${COMMIT} -X main.gitBranch=${BRANCH}" .PHONY: help \ clean lint test race \ @@ -72,11 +55,6 @@ docker-build: ## Build docker image docker image prune --force --filter label=stage=intermediate docker tag ${DOCKER_ACCOUNT}/${APPNAME}:${TAG} ${DOCKER_ACCOUNT}/${APPNAME}:latest -docker-build-branch: ## Build docker image from branch for test purposes - docker build -t ${DOCKER_ACCOUNT}/${APPNAME}:${BRANCH} . - docker image prune --force --filter label=stage=intermediate - #docker push ${DOCKER_ACCOUNT}/${APPNAME}:${BRANCH} - docker-push: ## Push docker image docker push ${DOCKER_ACCOUNT}/${APPNAME}:${TAG} docker push ${DOCKER_ACCOUNT}/${APPNAME}:latest