mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-23 00:46:30 +00:00
Release windows binaries as zip file (#3906)
This commit is contained in:
parent
008378fae9
commit
904d8da51a
4 changed files with 43 additions and 11 deletions
|
@ -1,12 +1,15 @@
|
|||
when:
|
||||
event: tag
|
||||
- event: tag
|
||||
- event: pull_request
|
||||
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||
path: Makefile
|
||||
|
||||
variables:
|
||||
- &golang_image 'docker.io/golang:1.22'
|
||||
- &node_image 'docker.io/node:22-alpine'
|
||||
- &xgo_image 'docker.io/techknowlogick/xgo:go-1.22.x'
|
||||
|
||||
# cspell:words bindata netgo TARGZ
|
||||
# cspell:words bindata netgo
|
||||
|
||||
steps:
|
||||
build-web:
|
||||
|
@ -35,7 +38,7 @@ steps:
|
|||
environment:
|
||||
PLATFORMS: linux|arm64/v8;linux|amd64;windows|amd64
|
||||
TAGS: bindata sqlite sqlite_unlock_notify netgo
|
||||
TARGZ: '1'
|
||||
ARCHIVE_IT: '1'
|
||||
|
||||
build-tarball:
|
||||
depends_on:
|
||||
|
@ -50,6 +53,8 @@ steps:
|
|||
- vendor
|
||||
image: *golang_image
|
||||
commands:
|
||||
- apt update
|
||||
- apt install -y zip
|
||||
- make release-agent
|
||||
|
||||
build-cli:
|
||||
|
@ -57,6 +62,8 @@ steps:
|
|||
- vendor
|
||||
image: *golang_image
|
||||
commands:
|
||||
- apt update
|
||||
- apt install -y zip
|
||||
- make release-cli
|
||||
|
||||
build-deb-rpm:
|
||||
|
@ -96,7 +103,10 @@ steps:
|
|||
from_secret: github_token
|
||||
files:
|
||||
- dist/*.tar.gz
|
||||
- dist/*.zip
|
||||
- dist/*.deb
|
||||
- dist/*.rpm
|
||||
- dist/checksums.txt
|
||||
title: ${CI_COMMIT_TAG##v}
|
||||
when:
|
||||
event: tag
|
||||
|
|
|
@ -9,7 +9,7 @@ variables:
|
|||
- &platforms_alpine 'linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le'
|
||||
- &build_args 'CI_COMMIT_SHA=${CI_COMMIT_SHA},CI_COMMIT_BRANCH=${CI_COMMIT_BRANCH},CI_COMMIT_TAG=${CI_COMMIT_TAG}'
|
||||
|
||||
# cspell:words woodpeckerbot netgo TARGZ
|
||||
# cspell:words woodpeckerbot netgo
|
||||
|
||||
# vars used on push / tag events only
|
||||
- publish_logins: &publish_logins # Default DockerHub login
|
||||
|
|
35
Makefile
35
Makefile
|
@ -235,22 +235,39 @@ release-server-xgo: check-xgo ## Create server binaries for release using xgo
|
|||
@echo "arch orgi:$(TARGETARCH)"
|
||||
@echo "arch (xgo):$(TARGETARCH_XGO)"
|
||||
@echo "arch (buildx):$(TARGETARCH_BUILDX)"
|
||||
|
||||
# build via xgo
|
||||
CGO_CFLAGS="$(CGO_CFLAGS)" xgo -go $(XGO_VERSION) -dest ${DIST_DIR}/server/$(TARGETOS)_$(TARGETARCH_BUILDX) -tags 'netgo osusergo grpcnotrace $(TAGS)' -ldflags '-linkmode external $(LDFLAGS)' -targets '$(TARGETOS)/$(TARGETARCH_XGO)' -out woodpecker-server -pkg cmd/server .
|
||||
@if [ "$${XGO_IN_XGO:-0}" -eq "1" ]; then echo "inside xgo image"; \
|
||||
# move binary into subfolder depending on target os and arch
|
||||
@if [ "$${XGO_IN_XGO:-0}" -eq "1" ]; then \
|
||||
echo "inside xgo image"; \
|
||||
mkdir -p ${DIST_DIR}/server/$(TARGETOS)_$(TARGETARCH_BUILDX); \
|
||||
mv -vf /build/woodpecker-server* ${DIST_DIR}/server/$(TARGETOS)_$(TARGETARCH_BUILDX)/woodpecker-server$(BIN_SUFFIX); \
|
||||
else echo "outside xgo image"; \
|
||||
else \
|
||||
echo "outside xgo image"; \
|
||||
[ -f "${DIST_DIR}/server/$(TARGETOS)_$(TARGETARCH_BUILDX)/woodpecker-server$(BIN_SUFFIX)" ] && rm -v ${DIST_DIR}/server/$(TARGETOS)_$(TARGETARCH_BUILDX)/woodpecker-server$(BIN_SUFFIX); \
|
||||
mv -v ${DIST_DIR}/server/$(TARGETOS)_$(TARGETARCH_XGO)/woodpecker-server* ${DIST_DIR}/server/$(TARGETOS)_$(TARGETARCH_BUILDX)/woodpecker-server$(BIN_SUFFIX); \
|
||||
fi
|
||||
@[ "$${TARGZ:-0}" -eq "1" ] && tar -cvzf ${DIST_DIR}/woodpecker-server_$(TARGETOS)_$(TARGETARCH_BUILDX).tar.gz -C ${DIST_DIR}/server/$(TARGETOS)_$(TARGETARCH_BUILDX) woodpecker-server$(BIN_SUFFIX) || echo "skip creating '${DIST_DIR}/woodpecker-server_$(TARGETOS)_$(TARGETARCH_BUILDX).tar.gz'"
|
||||
# if enabled package it in an archive
|
||||
@if [ "$${ARCHIVE_IT:-0}" -eq "1" ]; then \
|
||||
if [ "$(BIN_SUFFIX)" = ".exe" ]; then \
|
||||
rm -f ${DIST_DIR}/woodpecker-server_$(TARGETOS)_$(TARGETARCH_BUILDX).zip; \
|
||||
zip -j ${DIST_DIR}/woodpecker-server_$(TARGETOS)_$(TARGETARCH_BUILDX).zip ${DIST_DIR}/server/$(TARGETOS)_$(TARGETARCH_BUILDX)/woodpecker-server.exe; \
|
||||
else \
|
||||
tar -cvzf ${DIST_DIR}/woodpecker-server_$(TARGETOS)_$(TARGETARCH_BUILDX).tar.gz -C ${DIST_DIR}/server/$(TARGETOS)_$(TARGETARCH_BUILDX) woodpecker-server$(BIN_SUFFIX); \
|
||||
fi; \
|
||||
else \
|
||||
echo "skip creating '${DIST_DIR}/woodpecker-server_$(TARGETOS)_$(TARGETARCH_BUILDX).tar.gz'"; \
|
||||
fi
|
||||
|
||||
release-server: ## Create server binaries for release
|
||||
# compile
|
||||
GOOS=$(TARGETOS) GOARCH=$(TARGETARCH) CGO_ENABLED=${CGO_ENABLED} go build -ldflags '${LDFLAGS}' -tags 'grpcnotrace $(TAGS)' -o ${DIST_DIR}/server/$(TARGETOS)_$(TARGETARCH)/woodpecker-server$(BIN_SUFFIX) go.woodpecker-ci.org/woodpecker/v2/cmd/server
|
||||
# tar binary files
|
||||
tar -cvzf ${DIST_DIR}/woodpecker-server_$(TARGETOS)_$(TARGETARCH).tar.gz -C ${DIST_DIR}/server/$(TARGETOS)_$(TARGETARCH) woodpecker-server$(BIN_SUFFIX)
|
||||
if [ "$(BIN_SUFFIX)" == ".exe" ]; then \
|
||||
zip -j ${DIST_DIR}/woodpecker-server_$(TARGETOS)_$(TARGETARCH).zip ${DIST_DIR}/server/$(TARGETOS)_$(TARGETARCH)/woodpecker-server.exe; \
|
||||
else \
|
||||
tar -cvzf ${DIST_DIR}/woodpecker-server_$(TARGETOS)_$(TARGETARCH).tar.gz -C ${DIST_DIR}/server/$(TARGETOS)_$(TARGETARCH) woodpecker-server$(BIN_SUFFIX); \
|
||||
fi
|
||||
|
||||
release-agent: ## Create agent binaries for release
|
||||
# compile
|
||||
|
@ -264,9 +281,11 @@ release-agent: ## Create agent binaries for release
|
|||
tar -cvzf ${DIST_DIR}/woodpecker-agent_linux_amd64.tar.gz -C ${DIST_DIR}/agent/linux_amd64 woodpecker-agent
|
||||
tar -cvzf ${DIST_DIR}/woodpecker-agent_linux_arm64.tar.gz -C ${DIST_DIR}/agent/linux_arm64 woodpecker-agent
|
||||
tar -cvzf ${DIST_DIR}/woodpecker-agent_linux_arm.tar.gz -C ${DIST_DIR}/agent/linux_arm woodpecker-agent
|
||||
tar -cvzf ${DIST_DIR}/woodpecker-agent_windows_amd64.tar.gz -C ${DIST_DIR}/agent/windows_amd64 woodpecker-agent.exe
|
||||
tar -cvzf ${DIST_DIR}/woodpecker-agent_darwin_amd64.tar.gz -C ${DIST_DIR}/agent/darwin_amd64 woodpecker-agent
|
||||
tar -cvzf ${DIST_DIR}/woodpecker-agent_darwin_arm64.tar.gz -C ${DIST_DIR}/agent/darwin_arm64 woodpecker-agent
|
||||
# zip binary files
|
||||
rm -f ${DIST_DIR}/woodpecker-agent_windows_amd64.zip
|
||||
zip -j ${DIST_DIR}/woodpecker-agent_windows_amd64.zip ${DIST_DIR}/agent/windows_amd64/woodpecker-agent.exe
|
||||
|
||||
release-cli: ## Create cli binaries for release
|
||||
# compile
|
||||
|
@ -280,9 +299,11 @@ release-cli: ## Create cli binaries for release
|
|||
tar -cvzf ${DIST_DIR}/woodpecker-cli_linux_amd64.tar.gz -C ${DIST_DIR}/cli/linux_amd64 woodpecker-cli
|
||||
tar -cvzf ${DIST_DIR}/woodpecker-cli_linux_arm64.tar.gz -C ${DIST_DIR}/cli/linux_arm64 woodpecker-cli
|
||||
tar -cvzf ${DIST_DIR}/woodpecker-cli_linux_arm.tar.gz -C ${DIST_DIR}/cli/linux_arm woodpecker-cli
|
||||
tar -cvzf ${DIST_DIR}/woodpecker-cli_windows_amd64.tar.gz -C ${DIST_DIR}/cli/windows_amd64 woodpecker-cli.exe
|
||||
tar -cvzf ${DIST_DIR}/woodpecker-cli_darwin_amd64.tar.gz -C ${DIST_DIR}/cli/darwin_amd64 woodpecker-cli
|
||||
tar -cvzf ${DIST_DIR}/woodpecker-cli_darwin_arm64.tar.gz -C ${DIST_DIR}/cli/darwin_arm64 woodpecker-cli
|
||||
# zip binary files
|
||||
rm -f ${DIST_DIR}/woodpecker-cli_windows_amd64.zip
|
||||
zip -j ${DIST_DIR}/woodpecker-cli_windows_amd64.zip ${DIST_DIR}/cli/windows_amd64/woodpecker-cli.exe
|
||||
|
||||
release-checksums: ## Create checksums for all release files
|
||||
# generate shas for tar files
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
# generic
|
||||
gnumake
|
||||
gnutar
|
||||
zip
|
||||
|
||||
# frontend
|
||||
nodejs_20
|
||||
|
|
Loading…
Reference in a new issue