Skip to content

Commit 6fbdacb

Browse files
Support Drone building binaries too
1 parent 948f6ca commit 6fbdacb

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Makefile

+18
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ HUGO_VERSION ?= 0.111.3
8282
GITHUB_REF_TYPE ?= branch
8383
GITHUB_REF_NAME ?= $(shell git rev-parse --abbrev-ref HEAD)
8484

85+
# backwards compatible to build with Drone
86+
ifneq ($(DRONE_TAG),)
87+
GITHUB_REF_TYPE := tag
88+
GITHUB_REF_NAME := DRONE_TAG
89+
endif
90+
8591
ifneq ($(GITHUB_REF_TYPE),branch)
8692
VERSION ?= $(subst v,,$(GITHUB_REF_NAME))
8793
GITEA_VERSION ?= $(GITHUB_REF_NAME)
@@ -834,18 +840,30 @@ release-windows: | $(DIST_DIRS)
834840
ifeq (,$(findstring gogit,$(TAGS)))
835841
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) run $(XGO_PACKAGE) -go $(XGO_VERSION) -buildmode exe -dest $(DIST)/binaries -tags 'osusergo gogit $(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets 'windows/*' -out gitea-$(VERSION)-gogit .
836842
endif
843+
ifneq ($(DRONE_TAG),)
844+
cp /build/* $(DIST)/binaries
845+
endif
837846

838847
.PHONY: release-linux
839848
release-linux: | $(DIST_DIRS)
840849
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) run $(XGO_PACKAGE) -go $(XGO_VERSION) -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets '$(LINUX_ARCHS)' -out gitea-$(VERSION) .
850+
ifneq ($(DRONE_TAG),)
851+
cp /build/* $(DIST)/binaries
852+
endif
841853

842854
.PHONY: release-darwin
843855
release-darwin: | $(DIST_DIRS)
844856
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) run $(XGO_PACKAGE) -go $(XGO_VERSION) -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '$(LDFLAGS)' -targets 'darwin-10.12/amd64,darwin-10.12/arm64' -out gitea-$(VERSION) .
857+
ifneq ($(DRONE_TAG),)
858+
cp /build/* $(DIST)/binaries
859+
endif
845860

846861
.PHONY: release-freebsd
847862
release-freebsd: | $(DIST_DIRS)
848863
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) run $(XGO_PACKAGE) -go $(XGO_VERSION) -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '$(LDFLAGS)' -targets 'freebsd/amd64' -out gitea-$(VERSION) .
864+
ifneq ($(DRONE_TAG),)
865+
cp /build/* $(DIST)/binaries
866+
endif
849867

850868
.PHONY: release-copy
851869
release-copy: | $(DIST_DIRS)

0 commit comments

Comments
 (0)