diff --git a/.drone.yml b/.drone.yml index cc04529..934ae73 100644 --- a/.drone.yml +++ b/.drone.yml @@ -15,14 +15,28 @@ steps: - name: Test commands: - make test +--- +kind: pipeline +type: exec +name: default + +platform: + os: linux + arch: amd64 + +steps: +- name: Setup + commands: + - make setup - name: Build Release commands: - - cd debian && make release - - cd debian && make build - - cd debian && make copy - - cd debian && make deploy - when: - event: - - promote + - cd debian + - make release + - make build + - make copy + - make deploy +trigger: + event: + - promote ... \ No newline at end of file diff --git a/debian/Makefile b/debian/Makefile index d1ec6e1..33e7ecd 100644 --- a/debian/Makefile +++ b/debian/Makefile @@ -1,6 +1,6 @@ NAME=sour.is-paste -VERSION=$(shell cat VERSION) -RELEASE=$(shell cat RELEASE) +VERSION:=$(shell cat VERSION) +RELEASE:=$(shell cat RELEASE) REPO_HOST="kapha" REPO_PATH="/opt/web/pub/sour.is/debian/" @@ -11,30 +11,29 @@ clean: rm -r BUILD/* release: - echo `expr $${RELEASE} + 1` > RELEASE - git commit -am "release version $${RELEASE}" - git tag -a -m "release version $${RELEASE}" v$${RELEASE} + @echo "release version $(RELEASE)" + @echo `expr $(RELEASE) + 1` > RELEASE + git commit -am "release version $(RELEASE)" + git tag -a -m "release version $(RELEASE)" "v$(RELEASE)" git push --tags build: - export BUILD="BUILD/$(NAME)_$${VERSION}-$${RELEASE}"; \ + export BUILD="BUILD/$(NAME)_$(VERSION)-$(RELEASE)"; \ rm -rf ./$${BUILD}; \ cp -r ROOT "$${BUILD}"; \ - sed -i'.tmp' "s_Version:.*_Version: $${VERSION}-$${RELEASE}_" "$${BUILD}/DEBIAN/control" + sed -i'.tmp' "s_Version:.*_Version: $(VERSION)-$(RELEASE)_" "$${BUILD}/DEBIAN/control" export DATE=`date -u +%FT%TZ`; \ - export BUILD="BUILD/$(NAME)_$${VERSION}-$${RELEASE}"; \ + export BUILD="BUILD/$(NAME)_$(VERSION)-$(RELEASE)"; \ env GOOS=linux GOARCH=amd64 go build -v -o $${BUILD}/opt/sour.is/bin/paste \ - -ldflags "-X main.AppVersion=$${VERSION}-$${RELEASE} -X main.AppBuild=$${DATE}"\ + -ldflags "-X main.AppVersion=$(VERSION)-$(RELEASE) -X main.AppBuild=$${DATE}"\ sour.is/x/paste/cmd/paste; \ dpkg -b $${BUILD}; copy: - export VERSION=`cat VERSION`; \ - export RELEASE=`cat RELEASE`; \ - export BUILD="BUILD/$(NAME)_$${VERSION}-$${RELEASE}"; \ + export BUILD="BUILD/$(NAME)_$(VERSION)-$(RELEASE)"; \ scp "$${BUILD}.deb" $(REPO_HOST):$(REPO_PATH); \ - ssh $(REPO_HOST) -- $(REPO_PATH)scan.sh "$(REPO_PATH)$(NAME)_$${VERSION}-$${RELEASE}.deb"; + ssh $(REPO_HOST) -- $(REPO_PATH)scan.sh "$(REPO_PATH)$(NAME)_$(VERSION)-$(RELEASE).deb"; deploy: ansible $(REPO_HOST) -b -m apt -a "name=sour.is-paste update_cache=yes state=latest"