diff --git a/Makefile b/Makefile index 3ad1d54..a269ae0 100644 --- a/Makefile +++ b/Makefile @@ -7,20 +7,25 @@ __check_defined = \ $(error Undefined $1$(if $2, ($2)))) RELEASE_BRANCH=master -VERSION = $(shell git describe --always --tag) -REPOSITORY = quay.io/poka/docker-haraka +GIT_DESCRIBE_TAG = $(shell git describe --always --tag) +VERSION = $(GIT_DESCRIBE_TAG) +CI_ACCOUNT_ID = $(shell aws ssm get-parameter --name organization.accounts.ci.id --query "Parameter.Value" --output text) +ECR_REPOSITORY = $(CI_ACCOUNT_ID).dkr.ecr.us-east-1.amazonaws.com/docker-haraka THIS_DIR:=$(shell pwd) version: @echo $(VERSION) +login_to_ecr: + @$(shell aws ecr get-login --no-include-email --registry-ids $(CI_ACCOUNT_ID) --region us-east-1) + build: - docker build --pull -t $(REPOSITORY):$(VERSION) . + @docker build --pull -t $(ECR_REPOSITORY):$(VERSION) . -push: - docker push $(REPOSITORY):$(VERSION) +push: login_to_ecr + @docker push $(ECR_REPOSITORY):$(VERSION) generate-changelog: $(call check_defined, FUTURE_RELEASE, Ex: make generate-changelog FUTURE_RELEASE=v1.0.0) - docker pull prooph/github-changelog-generator - docker run -e CHANGELOG_GITHUB_TOKEN=$(CHANGELOG_GITHUB_TOKEN) -it --rm -v $(THIS_DIR):/app prooph/github-changelog-generator --release-branch=master --no-issues --future-release=$(FUTURE_RELEASE) + @docker pull pokainc/github-changelog-generator + @docker run -e CHANGELOG_GITHUB_TOKEN=$(CHANGELOG_GITHUB_TOKEN) -it --rm -v $(THIS_DIR):/app pokainc/github-changelog-generator --future-release=$(FUTURE_RELEASE) diff --git a/buildspec.yml b/buildspec.yml new file mode 100644 index 0000000..366f298 --- /dev/null +++ b/buildspec.yml @@ -0,0 +1,14 @@ +version: 0.2 + +phases: + build: + commands: + - make build + + post_build: + commands: + - >- + if [ "$CODEBUILD_BUILD_SUCCEEDING" = "0" ]; then + exit 1; + fi + - make push