Skip to content

Commit 2221930

Browse files
committed
chore(workflow-cli): remove git dependency
1 parent 33769e5 commit 2221930

3 files changed

Lines changed: 18 additions & 27 deletions

File tree

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ steps:
99
privileged: true
1010
commands:
1111
- nohup dockerd &
12-
- apk add make bash curl git
13-
- make test
12+
- apk add make bash curl
13+
- VERSION=${DRONE_TAG:-latest} make test
14+
environment:
15+
DEV_REGISTRY:
16+
from_secret: dev_registry
1417
when:
1518
event:
1619
- push
@@ -23,9 +26,11 @@ steps:
2326
privileged: true
2427
commands:
2528
- nohup dockerd &
26-
- apk add make bash curl git
27-
- make build-tag
28-
- mv _dist/$DRONE_TAG dist
29+
- apk add make bash curl
30+
- VERSION=${DRONE_TAG:-latest} make build
31+
environment:
32+
DEV_REGISTRY:
33+
from_secret: dev_registry
2934
when:
3035
event:
3136
- tag
@@ -35,7 +40,7 @@ steps:
3540
settings:
3641
api_key:
3742
from_secret: github_token
38-
files: dist/*
43+
files: _dist/*
3944
when:
4045
event: tag
4146

Makefile

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,29 @@
11
# the filepath to this repository, relative to $GOPATH/src
22
REPO_PATH := github.com/drycc/workflow-cli
3-
DEV_ENV_IMAGE := drycc/go-dev
3+
DEV_ENV_IMAGE := ${DEV_REGISTRY}/drycc/go-dev
44
DEV_ENV_WORK_DIR := /go/src/${REPO_PATH}
55

6-
# The latest git tag on branch
7-
GIT_TAG ?= $(shell git describe --abbrev=0 --tags)
8-
REVISION ?= $(shell git rev-parse --short HEAD)
9-
10-
REGISTRY ?=
11-
IMAGE_PREFIX ?= drycc
12-
IMAGE := ${REGISTRY}${IMAGE_PREFIX}/workflow-cli-dev:${REVISION}
13-
146
DIST_DIR ?= _dist
157

168
DEV_ENV_CMD := docker run --rm -v ${CURDIR}:${DEV_ENV_WORK_DIR} -w ${DEV_ENV_WORK_DIR} ${DEV_ENV_IMAGE}
179

1810
define build-install-script
19-
sed "s|{{DRYCC-CLIENT-VERSION}}|${GIT_TAG}|g" "install.tmpl" > "${DIST_DIR}/$(1)/install-drycc.sh"
11+
sed "s|{{DRYCC-CLIENT-VERSION}}|${GIT_TAG}|g" "install.tmpl" > "${DIST_DIR}/install-drycc.sh"
2012
endef
2113

2214
bootstrap:
2315
${DEV_ENV_CMD} go mod vendor
2416

2517
# This is supposed to be run within a docker container
26-
build-revision:
27-
${DEV_ENV_CMD} scripts/build ${REVISION}
28-
29-
# This is supposed to be run within a docker container
30-
build-tag:
31-
${DEV_ENV_CMD} scripts/build ${GIT_TAG}
32-
@$(call build-install-script,${GIT_TAG})
33-
34-
build: build-tag build-revision
18+
build:
19+
${DEV_ENV_CMD} scripts/build ${VERSION}
20+
@$(call build-install-script,${VERSION})
3521

3622
test-style:
3723
${DEV_ENV_CMD} lint
3824

3925
test-cover:
4026
${DEV_ENV_CMD} test-cover.sh
4127

42-
test: build-revision test-style test-cover
28+
test: build test-style test-cover
4329
${DEV_ENV_CMD} go test ./...

scripts/build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go-build(){
55
GOOS=$GOOS \
66
GOARCH=$GOARCH \
77
go build \
8-
-o _dist/$1/drycc-$1-$GOOS-$GOARCH \
8+
-o _dist/drycc-$1-$GOOS-$GOARCH \
99
drycc.go
1010
}
1111

0 commit comments

Comments
 (0)