Skip to content

Commit a6acbb1

Browse files
committed
fix release versioning
1 parent 6f86aba commit a6acbb1

File tree

2 files changed

+16
-19
lines changed

2 files changed

+16
-19
lines changed

Makefile

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ BASE_IMAGE := "savantly/wordpress"
99
BASE_TAG := "6.6.1-php8.1-fpm"
1010

1111
VERSION := $(shell cat VERSION)
12+
# Strip -dev from version
13+
VERSION := $(shell echo $(VERSION) | sed 's/-dev//')
1214
TAGGED_VERSION := $(VERSION)
13-
NEXT_VERSION := $(shell echo $(VERSION) | awk -F. '{$$NF = $$NF + 1;} 1' | sed 's/ /./g')
15+
NEXT_VERSION := $(shell echo $(VERSION) | awk -F. '{$$NF = $$NF + 1;} 1' | sed 's/ /./g')-dev
1416

1517
# IMAGE_NAME - from project.mk
1618
IMAGE_TAG := "$(IMAGE_NAME):$(BASE_TAG)-$(TAGGED_VERSION)"
@@ -55,37 +57,31 @@ ensure-git-repo-pristine:
5557
@echo "Ensuring git repo is pristine"
5658
@[[ $(shell git status --porcelain=v1 2>/dev/null | wc -l) -gt 0 ]] && echo "Git repo is not pristine" && exit 1 || echo "Git repo is pristine"
5759

58-
5960
.PHONY: bump-version
6061
bump-version:
6162
@echo "Bumping version to $(NEXT_VERSION)"
6263
@echo $(NEXT_VERSION) > VERSION
6364
git add VERSION
6465
git commit -m "Published $(VERSION) and prepared for $(NEXT_VERSION)"
6566

66-
67-
.PHONY: push
68-
push: ensure-git-repo-pristine
69-
@echo "Building..."
70-
@docker buildx build --platform=linux/amd64,linux/arm64 \
71-
--build-arg="BASE_IMAGE=$(BASE_IMAGE)" \
72-
--build-arg="BASE_TAG=$(BASE_TAG)" \
73-
--push -t $(IMAGE_TAG) -t $(IMAGE_TAG_LATEST) .
74-
@echo "Done!"
75-
76-
77-
.PHONY: release
78-
release: push bump-version
67+
.PHONY: tag-version
68+
tag-version:
7969
@echo "Preparing release..."
8070
@echo "Version: $(VERSION)"
81-
@echo "BASE_IMAGE: $(BASE_IMAGE)"
82-
@echo "BASE_TAG: $(BASE_TAG)"
8371
@echo "Commit: $(GIT_COMMIT)"
8472
@echo "Image Tag: $(IMAGE_TAG)"
73+
@echo $(VERSION) > VERSION
74+
git add VERSION
75+
git commit -m "Published $(VERSION)"
8576
git tag -a $(TAGGED_VERSION) -m "Release $(VERSION)"
8677
git push origin $(TAGGED_VERSION)
8778
@echo "Tag $(TAGGED_VERSION) created and pushed to origin"
8879

80+
.PHONY: release
81+
release: ensure-git-repo-pristine tag-version bump-version
82+
git push
83+
@echo "Release $(VERSION) completed and pushed to origin"
84+
8985

9086
.PHONY: dev
9187
dev:
@@ -133,4 +129,5 @@ pod-logs:
133129
reveal-cicd-creds:
134130
@echo "Revealing cicd creds..."
135131
@kubectl get secret cicd -n $(K8S_NAMESPACE) -o jsonpath="{.data.AWS_ACCESS_KEY_ID}" | base64 --decode
132+
@echo " "
136133
@kubectl get secret cicd -n $(K8S_NAMESPACE) -o jsonpath="{.data.AWS_SECRET_ACCESS_KEY}" | base64 --decode

project.mk.example

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ K8S_NAMESPACE_PROD := abc
66
K8S_DEPLOYMENT_PROD := xyz
77
PROFILE := 'dev'
88

9-
ifeq ($(PROFILE),'dev')
9+
ifeq ($(PROFILE),dev)
1010
K8S_NAMESPACE := $(K8S_NAMESPACE_DEV)
1111
K8S_DEPLOYMENT := $(K8S_DEPLOYMENT_DEV)
12-
else
12+
else ifeq($(PROFILE),prod)
1313
K8S_NAMESPACE := $(K8S_NAMESPACE_PROD)
1414
K8S_DEPLOYMENT := $(K8S_DEPLOYMENT_PROD)
1515
endif

0 commit comments

Comments
 (0)