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 export CGO_ENABLED=0
# compile for all architectures # 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=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/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/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/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/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/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/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/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/drone
# tar binary files prior to upload # tar binary files prior to upload
tar -cvzf cli/release/woodpecker_linux_amd64.tar.gz -C cli/release/linux/amd64 woodpecker tar -cvzf cli/release/woodpecker_linux_amd64.tar.gz -C cli/release/linux/amd64 woodpecker

View File

@@ -4,7 +4,7 @@ clone:
pipeline: pipeline:
test: test:
image: golang:1.13.3 image: golang:1.16
group: test group: test
commands: commands:
- go test -cover -timeout 30s $(go list ./...) - go test -cover -timeout 30s $(go list ./...)
@@ -19,7 +19,7 @@ pipeline:
- make test-frontend - make test-frontend
test-postgres: test-postgres:
image: golang:1.13.3 image: golang:1.16
group: db-test group: db-test
environment: environment:
- DATABASE_DRIVER=postgres - DATABASE_DRIVER=postgres
@@ -28,7 +28,7 @@ pipeline:
- go test -timeout 30s github.com/laszlocph/woodpecker/store/datastore - go test -timeout 30s github.com/laszlocph/woodpecker/store/datastore
test-mysql: test-mysql:
image: golang:1.13.3 image: golang:1.16
group: db-test group: db-test
environment: environment:
- DATABASE_DRIVER=mysql - DATABASE_DRIVER=mysql
@@ -42,7 +42,7 @@ pipeline:
- make build-frontend - make build-frontend
build: build:
image: golang:1.13.3 image: golang:1.16
commands: commands:
- go get github.com/laszlocph/togo - go get github.com/laszlocph/togo
- (cd web/; go generate ./...) - (cd web/; go generate ./...)
@@ -60,6 +60,10 @@ pipeline:
# branch: master # branch: master
# event: push # event: push
build-cli:
image: golang:1.16
commands: sh .cli.sh
publish-server: publish-server:
image: plugins/docker image: plugins/docker
repo: laszlocloud/woodpecker-server repo: laszlocloud/woodpecker-server
@@ -124,6 +128,17 @@ pipeline:
when: when:
event: tag 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: services:
postgres: postgres:
image: postgres:9.6 image: postgres:9.6

View File

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