update runner

This commit is contained in:
Xuu 2020-08-17 12:36:48 -06:00
parent 0d6a4dbeab
commit 5c7be28750
Signed by: xuu
GPG Key ID: 8B3B0604F164E04F
2 changed files with 33 additions and 20 deletions

View File

@ -15,14 +15,28 @@ steps:
- name: Test - name: Test
commands: commands:
- make test - make test
---
kind: pipeline
type: exec
name: default
platform:
os: linux
arch: amd64
steps:
- name: Setup
commands:
- make setup
- name: Build Release - name: Build Release
commands: commands:
- cd debian && make release - cd debian
- cd debian && make build - make release
- cd debian && make copy - make build
- cd debian && make deploy - make copy
when: - make deploy
event: trigger:
- promote event:
- promote
... ...

25
debian/Makefile vendored
View File

@ -1,6 +1,6 @@
NAME=sour.is-paste NAME=sour.is-paste
VERSION=$(shell cat VERSION) VERSION:=$(shell cat VERSION)
RELEASE=$(shell cat RELEASE) RELEASE:=$(shell cat RELEASE)
REPO_HOST="kapha" REPO_HOST="kapha"
REPO_PATH="/opt/web/pub/sour.is/debian/" REPO_PATH="/opt/web/pub/sour.is/debian/"
@ -11,30 +11,29 @@ clean:
rm -r BUILD/* rm -r BUILD/*
release: release:
echo `expr $${RELEASE} + 1` > RELEASE @echo "release version $(RELEASE)"
git commit -am "release version $${RELEASE}" @echo `expr $(RELEASE) + 1` > RELEASE
git tag -a -m "release version $${RELEASE}" v$${RELEASE} git commit -am "release version $(RELEASE)"
git tag -a -m "release version $(RELEASE)" "v$(RELEASE)"
git push --tags git push --tags
build: build:
export BUILD="BUILD/$(NAME)_$${VERSION}-$${RELEASE}"; \ export BUILD="BUILD/$(NAME)_$(VERSION)-$(RELEASE)"; \
rm -rf ./$${BUILD}; \ rm -rf ./$${BUILD}; \
cp -r ROOT "$${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 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 \ 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; \ sour.is/x/paste/cmd/paste; \
dpkg -b $${BUILD}; dpkg -b $${BUILD};
copy: copy:
export VERSION=`cat VERSION`; \ export BUILD="BUILD/$(NAME)_$(VERSION)-$(RELEASE)"; \
export RELEASE=`cat RELEASE`; \
export BUILD="BUILD/$(NAME)_$${VERSION}-$${RELEASE}"; \
scp "$${BUILD}.deb" $(REPO_HOST):$(REPO_PATH); \ 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: deploy:
ansible $(REPO_HOST) -b -m apt -a "name=sour.is-paste update_cache=yes state=latest" ansible $(REPO_HOST) -b -m apt -a "name=sour.is-paste update_cache=yes state=latest"