forked from etcd-io/etcd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[3.4] Backport cherry-pick of etcd-io#14860: Trigger release in curre…
…nt branch for github workflow case Signed-off-by: ArkaSaha30 <[email protected]>
- Loading branch information
1 parent
bf22b35
commit 6656a0d
Showing
4 changed files
with
502 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,4 +23,4 @@ jobs: | |
Name-Email: [email protected] | ||
Expire-Date: 0 | ||
EOF | ||
DRY_RUN=true ./scripts/release.sh --no-upload --no-docker-push 3.4.99 | ||
DRY_RUN=true ./scripts/release.sh --no-upload --no-docker-push --in-place 3.4.99 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
source ./scripts/test_lib.sh | ||
|
||
VER=$1 | ||
REPOSITORY="${REPOSITORY:-git@github.com:etcd-io/etcd.git}" | ||
|
||
if [ -z "$1" ]; then | ||
echo "Usage: ${0} VERSION" >> /dev/stderr | ||
exit 255 | ||
fi | ||
|
||
set -u | ||
|
||
function setup_env { | ||
local ver=${1} | ||
local proj=${2} | ||
|
||
if [ ! -d "${proj}" ]; then | ||
run git clone "${REPOSITORY}" | ||
fi | ||
|
||
pushd "${proj}" >/dev/null | ||
run git fetch --all | ||
run git checkout "${ver}" | ||
popd >/dev/null | ||
} | ||
|
||
|
||
function package { | ||
local target=${1} | ||
local srcdir="${2}/bin" | ||
|
||
local ccdir="${srcdir}/${GOOS}_${GOARCH}" | ||
if [ -d "${ccdir}" ]; then | ||
srcdir="${ccdir}" | ||
fi | ||
local ext="" | ||
if [ "${GOOS}" == "windows" ]; then | ||
ext=".exe" | ||
fi | ||
for bin in etcd etcdctl etcdutl; do | ||
cp "${srcdir}/${bin}" "${target}/${bin}${ext}" | ||
done | ||
|
||
cp etcd/README.md "${target}"/README.md | ||
cp etcd/etcdctl/README.md "${target}"/README-etcdctl.md | ||
cp etcd/etcdctl/READMEv2.md "${target}"/READMEv2-etcdctl.md | ||
cp etcd/etcdutl/README.md "${target}"/README-etcdutl.md | ||
|
||
cp -R etcd/Documentation "${target}"/Documentation | ||
} | ||
|
||
function main { | ||
local proj="etcd" | ||
|
||
mkdir -p release | ||
cd release | ||
setup_env "${VER}" "${proj}" | ||
|
||
tarcmd=tar | ||
if [[ $(go env GOOS) == "darwin" ]]; then | ||
echo "Please use linux machine for release builds." | ||
exit 1 | ||
fi | ||
|
||
for os in darwin windows linux; do | ||
export GOOS=${os} | ||
TARGET_ARCHS=("amd64") | ||
|
||
if [ ${GOOS} == "linux" ]; then | ||
TARGET_ARCHS+=("arm64") | ||
TARGET_ARCHS+=("ppc64le") | ||
TARGET_ARCHS+=("s390x") | ||
fi | ||
|
||
if [ ${GOOS} == "darwin" ]; then | ||
TARGET_ARCHS+=("arm64") | ||
fi | ||
|
||
for TARGET_ARCH in "${TARGET_ARCHS[@]}"; do | ||
export GOARCH=${TARGET_ARCH} | ||
|
||
pushd etcd >/dev/null | ||
GO_LDFLAGS="-s -w" ./build.sh | ||
popd >/dev/null | ||
|
||
TARGET="etcd-${VER}-${GOOS}-${GOARCH}" | ||
mkdir "${TARGET}" | ||
package "${TARGET}" "${proj}" | ||
|
||
if [ ${GOOS} == "linux" ]; then | ||
${tarcmd} cfz "${TARGET}.tar.gz" "${TARGET}" | ||
echo "Wrote release/${TARGET}.tar.gz" | ||
else | ||
zip -qr "${TARGET}.zip" "${TARGET}" | ||
echo "Wrote release/${TARGET}.zip" | ||
fi | ||
done | ||
done | ||
} | ||
|
||
main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.