mirror of
https://github.com/Luzifer/dbx-sync.git
synced 2024-12-22 10:51:17 +00:00
Add CI
This commit is contained in:
parent
8f146a01a0
commit
8ac14fa4b4
3 changed files with 56 additions and 0 deletions
10
.repo-runner.yaml
Normal file
10
.repo-runner.yaml
Normal file
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
|
||||
image: "quay.io/luzifer/repo-runner-image"
|
||||
checkout_dir: /go/src/github.com/Luzifer/dbx-sync
|
||||
|
||||
commands:
|
||||
- make ci
|
||||
|
||||
environment:
|
||||
CGO_ENABLED: 0
|
20
Makefile
Normal file
20
Makefile
Normal file
|
@ -0,0 +1,20 @@
|
|||
VERSION := $(shell git describe --tags --exact-match)
|
||||
|
||||
ci: publish
|
||||
|
||||
qa:
|
||||
go get gopkg.in/alecthomas/gometalinter.v1
|
||||
gometalinter.v1 --vendored-linters --install
|
||||
gometalinter.v1 \
|
||||
-D gotype -D errcheck -D gas -D gocyclo \
|
||||
--sort path --sort line --deadline 1m --cyclo-over 15 \
|
||||
.
|
||||
|
||||
ifneq ($(strip $(VERSION)),)
|
||||
publish:
|
||||
VERSION=$(VERSION) sh -e publish.sh
|
||||
else
|
||||
publish:
|
||||
true
|
||||
endif
|
||||
|
26
publish.sh
Normal file
26
publish.sh
Normal file
|
@ -0,0 +1,26 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
REPO="dbx-sync"
|
||||
ARCHS="linux/386 linux/amd64 linux/arm darwin/amd64 darwin/386"
|
||||
|
||||
if [ -z "${VERSION}" ]; then
|
||||
echo "Please set \$VERSION environment variable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "${GITHUB_TOKEN}" ]; then
|
||||
echo "PLease set \$GITHUB_TOKEN environment variable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set -x
|
||||
|
||||
go get github.com/aktau/github-release
|
||||
go get github.com/mitchellh/gox
|
||||
|
||||
github-release release --user Luzifer --repo ${REPO} --tag ${VERSION} --name ${VERSION} || true
|
||||
|
||||
gox -ldflags="-X main.version=${VERSION}" -osarch="${ARCHS}"
|
||||
for file in ${REPO}_*; do
|
||||
github-release upload --user Luzifer --repo ${REPO} --tag ${VERSION} --name ${file} --file ${file}
|
||||
done
|
Loading…
Reference in a new issue