CLI build and release

This commit is contained in:
Laszlo Fogas 2021-02-19 09:26:11 +01:00
parent a200708a61
commit e0886ef450
3 changed files with 26 additions and 11 deletions

10
.cli.sh
View file

@ -6,11 +6,11 @@ set -x
export CGO_ENABLED=0
# compile for all architectures
GOOS=linux GOARCH=amd64 go build -ldflags "-X main.version=${DRONE_TAG##v}" -o cli/release/linux/amd64/woodpecker github.com/laszlocph/woodpecker/cli/woodpecker
GOOS=linux GOARCH=arm64 go build -ldflags "-X main.version=${DRONE_TAG##v}" -o cli/release/linux/arm64/woodpecker github.com/laszlocph/woodpecker/cli/woodpecker
GOOS=linux GOARCH=arm go build -ldflags "-X main.version=${DRONE_TAG##v}" -o cli/release/linux/arm/woodpecker github.com/laszlocph/woodpecker/cli/woodpecker
GOOS=windows GOARCH=amd64 go build -ldflags "-X main.version=${DRONE_TAG##v}" -o cli/release/windows/amd64/woodpecker github.com/laszlocph/woodpecker/cli/woodpecker
GOOS=darwin GOARCH=amd64 go build -ldflags "-X main.version=${DRONE_TAG##v}" -o cli/release/darwin/amd64/woodpecker github.com/laszlocph/woodpecker/cli/woodpecker
GOOS=linux GOARCH=amd64 go build -ldflags "-X main.version=${DRONE_TAG##v}" -o cli/release/linux/amd64/woodpecker github.com/laszlocph/woodpecker/cli/drone
GOOS=linux GOARCH=arm64 go build -ldflags "-X main.version=${DRONE_TAG##v}" -o cli/release/linux/arm64/woodpecker github.com/laszlocph/woodpecker/cli/drone
GOOS=linux GOARCH=arm go build -ldflags "-X main.version=${DRONE_TAG##v}" -o cli/release/linux/arm/woodpecker github.com/laszlocph/woodpecker/cli/drone
GOOS=windows GOARCH=amd64 go build -ldflags "-X main.version=${DRONE_TAG##v}" -o cli/release/windows/amd64/woodpecker github.com/laszlocph/woodpecker/cli/drone
GOOS=darwin GOARCH=amd64 go build -ldflags "-X main.version=${DRONE_TAG##v}" -o cli/release/darwin/amd64/woodpecker github.com/laszlocph/woodpecker/cli/drone
# tar binary files prior to upload
tar -cvzf cli/release/woodpecker_linux_amd64.tar.gz -C cli/release/linux/amd64 woodpecker

View file

@ -4,7 +4,7 @@ clone:
pipeline:
test:
image: golang:1.13.3
image: golang:1.16
group: test
commands:
- go test -cover -timeout 30s $(go list ./...)
@ -19,7 +19,7 @@ pipeline:
- make test-frontend
test-postgres:
image: golang:1.13.3
image: golang:1.16
group: db-test
environment:
- DATABASE_DRIVER=postgres
@ -28,7 +28,7 @@ pipeline:
- go test -timeout 30s github.com/laszlocph/woodpecker/store/datastore
test-mysql:
image: golang:1.13.3
image: golang:1.16
group: db-test
environment:
- DATABASE_DRIVER=mysql
@ -42,7 +42,7 @@ pipeline:
- make build-frontend
build:
image: golang:1.13.3
image: golang:1.16
commands:
- go get github.com/laszlocph/togo
- (cd web/; go generate ./...)
@ -60,6 +60,10 @@ pipeline:
# branch: master
# event: push
build-cli:
image: golang:1.16
commands: sh .cli.sh
publish-server:
image: plugins/docker
repo: laszlocloud/woodpecker-server
@ -124,6 +128,17 @@ pipeline:
when:
event: tag
release-cli:
image: plugins/github-release
files:
- release/drone_*.tar.gz
- release/drone_checksums.txt
secrets:
- source: github_token
target: github_release_api_key
when:
event: tag
services:
postgres:
image: postgres:9.6

View file

@ -48,8 +48,8 @@ pipeline:
release:
image: plugins/github-release
files:
- release/drone_*.tar.gz
- release/drone_checksums.txt
- release/woodpecker_*.tar.gz
- release/woodpecker_checksums.txt
secrets:
- source: github_token
target: github_release_api_key