snapshot of https://github.com/go-gitea/gitea.git (main, 2026-09-15; blobs > 131072B omitted)
Some checks failed
cache-seeder / prune (push) Has been skipped
cache-seeder / frontend (push) Failing after 3s
cache-seeder / python (push) Failing after 3s
cache-seeder / gobuild (push) Failing after 4s
cache-seeder / lint (bindata, lint-backend) (push) Failing after 3s
giteabot backport / giteabot (push) Has been skipped
giteabot / giteabot (push) Has been skipped
cache-prune / prune (push) Has been skipped
release-nightly-snapcraft / build-and-publish (ubuntu-24.04) (push) Has been cancelled
release-nightly-snapcraft / build-and-publish (ubuntu-24.04-arm) (push) Has been cancelled
release-nightly / nightly-binary (push) Has been cancelled
release-nightly / nightly-container (push) Has been cancelled
cron-renovate / cron-renovate (push) Has been skipped
Some checks failed
cache-seeder / prune (push) Has been skipped
cache-seeder / frontend (push) Failing after 3s
cache-seeder / python (push) Failing after 3s
cache-seeder / gobuild (push) Failing after 4s
cache-seeder / lint (bindata, lint-backend) (push) Failing after 3s
giteabot backport / giteabot (push) Has been skipped
giteabot / giteabot (push) Has been skipped
cache-prune / prune (push) Has been skipped
release-nightly-snapcraft / build-and-publish (ubuntu-24.04) (push) Has been cancelled
release-nightly-snapcraft / build-and-publish (ubuntu-24.04-arm) (push) Has been cancelled
release-nightly / nightly-binary (push) Has been cancelled
release-nightly / nightly-container (push) Has been cancelled
cron-renovate / cron-renovate (push) Has been skipped
This commit is contained in:
72
tools/build-release.sh
Executable file
72
tools/build-release.sh
Executable file
@@ -0,0 +1,72 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
GO="${GO:-go}"
|
||||
RELEASE_LDFLAGS="-s -w $LDFLAGS"
|
||||
RELEASE_TAGS="bindata $TAGS"
|
||||
RELEASE_PATH_PREFIX="${DIST}/binaries/gitea-${VERSION##*/}"
|
||||
|
||||
RELEASE_PLATFORMS_DEFAULT=(
|
||||
linux/amd64 linux/arm-5 linux/arm-6 linux/arm64 linux/riscv64 \
|
||||
windows/amd64 windows/arm64 \
|
||||
darwin/amd64 darwin/arm64 \
|
||||
freebsd/amd64
|
||||
)
|
||||
|
||||
RELEASE_PLATFORMS_GOGIT=(windows/amd64 windows/arm64)
|
||||
|
||||
build() {
|
||||
echo "building ${*} ..."
|
||||
local target="${1:?}"
|
||||
local variant="${2:-}"
|
||||
|
||||
local goos="${target%%/*}"
|
||||
local goarch="${target##*/}"
|
||||
local goarm=""
|
||||
if [[ "$goarch" == arm-* ]]; then
|
||||
goarm="${goarch#arm-}"
|
||||
goarch="arm"
|
||||
fi
|
||||
|
||||
local tags="${RELEASE_TAGS}"
|
||||
local suffix
|
||||
if [[ "$variant" == "gogit" ]]; then
|
||||
tags="gogit${tags:+ ${tags}}"
|
||||
suffix="-gogit-${target//\//-}"
|
||||
else
|
||||
suffix="-${target//\//-}"
|
||||
fi
|
||||
|
||||
local output="${RELEASE_PATH_PREFIX}${suffix}"
|
||||
local args=()
|
||||
if [[ "$goos" == "windows" ]]; then
|
||||
output="${output}.exe"
|
||||
fi
|
||||
args+=(-tags "$tags")
|
||||
args+=(-ldflags "$RELEASE_LDFLAGS")
|
||||
echo " args: ${args[*]}"
|
||||
echo " output: ${output}"
|
||||
# must disable CGO (host compiler & linker) to get host-independent static builds
|
||||
CGO_ENABLED=0 GOOS="$goos" GOARCH="$goarch" GOARM="$goarm" "$GO" build "${args[@]}" -o "$output" .
|
||||
}
|
||||
|
||||
main() {
|
||||
# When building release binaries, some TAGS (bindata) are needed by the release script,
|
||||
# so here it needs to use the TAGS to generate the assets (embed bindata).
|
||||
echo "generating assets with tags=${RELEASE_TAGS}"
|
||||
"$GO" generate -tags "${RELEASE_TAGS}" ./...
|
||||
local platform="${1:-}"
|
||||
for target in "${RELEASE_PLATFORMS_DEFAULT[@]}"; do
|
||||
if [[ -z "$platform" || "$target" == "$platform/"* ]]; then
|
||||
build "$target"
|
||||
fi
|
||||
done
|
||||
|
||||
for target in "${RELEASE_PLATFORMS_GOGIT[@]}"; do
|
||||
if [[ -z "$platform" || "$target" == "$platform/"* ]]; then
|
||||
build "$target" "gogit"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
main "$@"
|
||||
Reference in New Issue
Block a user