Skip to content

Commit

Permalink
Merge pull request #178 from asciidoctor/hotfix/fix-tag-deploy
Browse files Browse the repository at this point in the history
Fix the tag deploy step
  • Loading branch information
dduportal committed Jan 29, 2021
2 parents a4da744 + 783d70f commit 44e6ff9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ jobs:
run: |
git config --local user.name "${GITHUB_ACTOR}"
git config --local user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: Set up env vars
run: echo "CURRENT_GIT_REF='$(echo ${GITHUB_REF} | awk 'BEGIN { FS = "/" } ; { print $3 }')'" >> "${GITHUB_ENV}" # Pass the tag, or target branch for a PR, or the branch
- name: Build
run: |
make build
Expand Down
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@
DOCKER_IMAGE_NAME ?= docker-asciidoctor
DOCKERHUB_USERNAME ?= asciidoctor
export DOCKER_BUILDKIT=1
CURRENT_GIT_REF ?= $(shell git rev-parse --abbrev-ref HEAD) # Default to current branch
DOCKER_IMAGE_TAG ?= $(shell echo $(CURRENT_GIT_REF) | sed 's/\//-/' )
GIT_TAG = $(shell git describe --exact-match --tags HEAD 2>/dev/null)
ifeq ($(strip $(GIT_TAG)),)
GIT_REF = $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null)
else
GIT_REF = $(GIT_TAG)
endif
DOCKER_IMAGE_TAG ?= $(shell echo $(GIT_REF) | sed 's/\//-/' )
DOCKER_IMAGE_NAME_TO_TEST ?= $(DOCKERHUB_USERNAME)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)
ASCIIDOCTOR_VERSION ?= 2.0.12
ASCIIDOCTOR_CONFLUENCE_VERSION ?= 0.0.2
Expand Down Expand Up @@ -45,7 +50,7 @@ deploy:
ifdef DOCKERHUB_SOURCE_TOKEN
ifdef DOCKERHUB_TRIGGER_TOKEN
curl --verbose --header "Content-Type: application/json" \
--data '{"source_type": "$(shell [ -n "${TRAVIS_TAG}" ] && echo Tag || echo Branch)", "source_name": "$(CURRENT_GIT_REF)"}' \
--data '{"source_type": "$(shell [ -n "$(GIT_TAG)" ] && echo Tag || echo Branch)", "source_name": "$(GIT_REF)"}' \
-X POST https://hub.docker.com/api/build/v1/source/$(DOCKERHUB_SOURCE_TOKEN)/trigger/$(DOCKERHUB_TRIGGER_TOKEN)/call/
else
@echo 'Unable to deploy: Please define $$DOCKERHUB_TRIGGER_TOKEN'
Expand Down

0 comments on commit 44e6ff9

Please sign in to comment.