Skip to content

Commit 44e6ff9

Browse files
authored
Merge pull request #178 from asciidoctor/hotfix/fix-tag-deploy
Fix the tag deploy step
2 parents a4da744 + 783d70f commit 44e6ff9

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ jobs:
1414
run: |
1515
git config --local user.name "${GITHUB_ACTOR}"
1616
git config --local user.email "${GITHUB_ACTOR}@users.noreply.github.com"
17-
- name: Set up env vars
18-
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
1917
- name: Build
2018
run: |
2119
make build

Makefile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@
22
DOCKER_IMAGE_NAME ?= docker-asciidoctor
33
DOCKERHUB_USERNAME ?= asciidoctor
44
export DOCKER_BUILDKIT=1
5-
CURRENT_GIT_REF ?= $(shell git rev-parse --abbrev-ref HEAD) # Default to current branch
6-
DOCKER_IMAGE_TAG ?= $(shell echo $(CURRENT_GIT_REF) | sed 's/\//-/' )
5+
GIT_TAG = $(shell git describe --exact-match --tags HEAD 2>/dev/null)
6+
ifeq ($(strip $(GIT_TAG)),)
7+
GIT_REF = $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null)
8+
else
9+
GIT_REF = $(GIT_TAG)
10+
endif
11+
DOCKER_IMAGE_TAG ?= $(shell echo $(GIT_REF) | sed 's/\//-/' )
712
DOCKER_IMAGE_NAME_TO_TEST ?= $(DOCKERHUB_USERNAME)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)
813
ASCIIDOCTOR_VERSION ?= 2.0.12
914
ASCIIDOCTOR_CONFLUENCE_VERSION ?= 0.0.2
@@ -45,7 +50,7 @@ deploy:
4550
ifdef DOCKERHUB_SOURCE_TOKEN
4651
ifdef DOCKERHUB_TRIGGER_TOKEN
4752
curl --verbose --header "Content-Type: application/json" \
48-
--data '{"source_type": "$(shell [ -n "${TRAVIS_TAG}" ] && echo Tag || echo Branch)", "source_name": "$(CURRENT_GIT_REF)"}' \
53+
--data '{"source_type": "$(shell [ -n "$(GIT_TAG)" ] && echo Tag || echo Branch)", "source_name": "$(GIT_REF)"}' \
4954
-X POST https://hub.docker.com/api/build/v1/source/$(DOCKERHUB_SOURCE_TOKEN)/trigger/$(DOCKERHUB_TRIGGER_TOKEN)/call/
5055
else
5156
@echo 'Unable to deploy: Please define $$DOCKERHUB_TRIGGER_TOKEN'

0 commit comments

Comments
 (0)