From 31380e1205c3265600af0dd0f10b544dc7bad879 Mon Sep 17 00:00:00 2001 From: Timo Reymann Date: Mon, 26 Jun 2023 15:44:38 +0200 Subject: [PATCH] fix: Set release version on semantic-release --- .circleci/config.yml | 26 ++++---------------------- .releaserc.json | 3 +++ Makefile | 6 +++++- 3 files changed, 12 insertions(+), 23 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index bd0224b..e44ddbc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,28 +5,13 @@ orbs: semantic-release: trustedshops-public/semantic-release@5.1.1 jobs: - build: - docker: - - image: cimg/base:2023.06 - steps: - - checkout - - setup_remote_docker - - run: - name: Build script - command: make build - - store_artifacts: - path: dist/ - - persist_to_workspace: - paths: - . dist/ - root: . semantic-release: executor: semantic-release/default steps: - checkout - - attach_workspace: - at: . - - semantic-release/install + - setup_remote_docker + - semantic-release/install: + additional_packages: '@semantic-release/exec' - semantic-release/execute workflows: @@ -35,10 +20,7 @@ workflows: - shellcheck/check: name: shellcheck dir: src - - build: - requires: - - shellcheck - semantic-release: requires: - - build + - shellcheck diff --git a/.releaserc.json b/.releaserc.json index 9a4c2c7..2b7e330 100644 --- a/.releaserc.json +++ b/.releaserc.json @@ -28,6 +28,9 @@ "assets": "CHANGELOG.md" } ], + ["@semantic-release/exec", { + "prepareCmd": "VERSION=${nextRelease.version} make build" + }], [ "@semantic-release/github", { diff --git a/Makefile b/Makefile index 15746f6..0ef0f38 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,10 @@ SHELL := /bin/bash .PHONY: help -VERSION=$(shell git describe --tags `git rev-list --tags --max-count=1`) +ifdef $(VERSION) + VERSION=$((VERSION)) +else + VERSION=$(shell git describe --tags `git rev-list --tags --max-count=1`) +endif help: ## Display this help page @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[33m%-30s\033[0m %s\n", $$1, $$2}'