From 9e862ae44bb0f35f1487a48dcc5ac9fe3e4337d5 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sun, 21 Jan 2024 22:18:20 +0100 Subject: [PATCH] Build tarball for distribution packages (#3244) close #3219 and also make sure the `binaries` & `docker` workflow will run on tag events, see https://ci.woodpecker-ci.org/repos/3780/pipeline/12358 --- .woodpecker/binaries.yaml | 21 ++++++++++++++++----- .woodpecker/docker.yaml | 4 ---- Makefile | 11 +++++++++++ 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/.woodpecker/binaries.yaml b/.woodpecker/binaries.yaml index cd1e08930..3e84dff31 100644 --- a/.woodpecker/binaries.yaml +++ b/.woodpecker/binaries.yaml @@ -1,8 +1,3 @@ -depends_on: - - test - - web - -# TODO: upload build artifacts for pushes to ${CI_REPO_DEFAULT_BRANCH} when: event: tag @@ -26,6 +21,13 @@ steps: commands: - go mod vendor + code-gen: + image: *golang_image + depends_on: + - vendor + commands: + - make generate + cross-compile-server: depends_on: - vendor @@ -42,6 +44,14 @@ steps: XGO_VERSION: *xgo_version TARGZ: '1' + build-tarball: + depends_on: + - code-gen + - build-web + image: *golang_image + commands: + - make build-tarball + build-agent: depends_on: - vendor @@ -71,6 +81,7 @@ steps: - build-agent - build-cli - build-deb-rpm + - build-tarball image: *golang_image commands: - make release-checksums diff --git a/.woodpecker/docker.yaml b/.woodpecker/docker.yaml index cd3d16ae1..2ba617d5a 100644 --- a/.woodpecker/docker.yaml +++ b/.woodpecker/docker.yaml @@ -6,10 +6,6 @@ when: - release/* - renovate/* -depends_on: - - test - - web - variables: - &golang_image 'docker.io/golang:1.21.6' - &node_image 'docker.io/node:21-alpine' diff --git a/Makefile b/Makefile index 0ef22575e..0b0f700f5 100644 --- a/Makefile +++ b/Makefile @@ -196,6 +196,17 @@ build-agent: ## Build agent build-cli: ## Build cli CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags '${LDFLAGS}' -o dist/woodpecker-cli${BIN_SUFFIX} go.woodpecker-ci.org/woodpecker/v2/cmd/cli +build-tarball: ## Build tar archive + mkdir -p dist && tar chzvf dist/woodpecker-src.tar.gz \ + --exclude="*.exe" \ + --exclude="./.pnpm-store" \ + --exclude="node_modules" \ + --exclude="./dist" \ + --exclude="./data" \ + --exclude="./build" \ + --exclude="./.git" \ + . + .PHONY: build build: build-agent build-server build-cli ## Build all binaries