Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
v1v authored and SergeyKleyman committed Feb 10, 2021
1 parent 7f5624b commit 1936dcf
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 deletions.
17 changes: 11 additions & 6 deletions .ci/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ CURRENT_GID := $(shell id -g)

.PHONY: help
.DEFAULT_GOAL := help
help: ## Display this help text
help: ## Display this help text
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'

.PHONY: prepare-release
prepare-release: ## Prepare the dependencies to run the release
.PHONY: prepare
prepare: ## Prepare the dependencies to run the release
@docker build --tag gren -f .ci/docker/gren/Dockerfile .

.PHONY: release
release: prepare-release ## Run a release given the GITHUB_TOKEN and TAG_NAME
run-%: prepare ## Run either a release or changelog generation given the GITHUB_TOKEN and TAG_NAME
ifndef GITHUB_TOKEN
@echo "Please set GITHUB_TOKEN in the environment to generate the changelog"
exit 1
Expand All @@ -28,4 +27,10 @@ endif
--env GITHUB_TOKEN=$(GITHUB_TOKEN) \
--env TAG_NAME=$(TAG_NAME) \
-u $(CURRENT_UID):$(CURRENT_GID) \
gren
gren $*

.PHONY: release
release: run-release ## Run a release given the GITHUB_TOKEN and TAG_NAME

.PHONY: changelog
changelog: run-changelog ## Create the changelog given the GITHUB_TOKEN and TAG_NAME
3 changes: 2 additions & 1 deletion .ci/docker/gren/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ RUN apt-get update -qq -y \
RUN npm install github-release-notes@0.17.3 -g
WORKDIR /app

ENTRYPOINT [ "/app/.ci/docker/gren/entrypoint.sh" ]
ENTRYPOINT [ "/app/.ci/docker/gren/entrypoint.sh" ]
CMD [ "release" ]
15 changes: 13 additions & 2 deletions .ci/docker/gren/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
#!/usr/bin/env bash
set -exo pipefail
set -eo pipefail

/usr/local/bin/gren release \
TYPE=${1:-release}

if [ "${TYPE}" == "release" ] ; then
/usr/local/bin/gren release \
--token="${GITHUB_TOKEN}" \
--tags="${TAG_NAME}" \
--config .ci/.grenrc.js
else
/usr/local/bin/gren changelog \
--generate \
--override \
--token="${GITHUB_TOKEN}" \
--tags="${TAG_NAME}" \
--config .ci/.grenrc.js
fi

0 comments on commit 1936dcf

Please sign in to comment.