TUN-4772: Release built executables with packages
This commit is contained in:
parent
8527d03a29
commit
cd4af5696d
|
@ -1,3 +1,5 @@
|
||||||
|
VERSION=$(git describe --tags --always --dirty="-dev" --match "[0-9][0-9][0-9][0-9].*.*")
|
||||||
|
echo $VERSION
|
||||||
export CGO_ENABLED=0
|
export CGO_ENABLED=0
|
||||||
# This controls the directory the built artifacts go into
|
# This controls the directory the built artifacts go into
|
||||||
export ARTIFACT_DIR=built_artifacts/
|
export ARTIFACT_DIR=built_artifacts/
|
||||||
|
@ -7,9 +9,10 @@ export TARGET_OS=windows
|
||||||
for arch in ${windowsArchs[@]}; do
|
for arch in ${windowsArchs[@]}; do
|
||||||
export TARGET_ARCH=$arch
|
export TARGET_ARCH=$arch
|
||||||
make cloudflared-msi
|
make cloudflared-msi
|
||||||
|
mv ./cloudflared.exe $ARTIFACT_DIR/cloudflared-windows-$arch.exe
|
||||||
|
mv cloudflared-$VERSION-$arch.msi $ARTIFACT_DIR/cloudflared-windows-$arch.msi
|
||||||
done
|
done
|
||||||
|
|
||||||
mv *.msi $ARTIFACT_DIR
|
|
||||||
|
|
||||||
export FIPS=true
|
export FIPS=true
|
||||||
linuxArchs=("amd64" "386" "arm")
|
linuxArchs=("amd64" "386" "arm")
|
||||||
|
@ -17,8 +20,18 @@ export TARGET_OS=linux
|
||||||
for arch in ${linuxArchs[@]}; do
|
for arch in ${linuxArchs[@]}; do
|
||||||
export TARGET_ARCH=$arch
|
export TARGET_ARCH=$arch
|
||||||
make cloudflared-deb
|
make cloudflared-deb
|
||||||
|
mv cloudflared\_$VERSION\_$arch.deb $ARTIFACT_DIR/cloudflared-linux-$arch.deb
|
||||||
|
|
||||||
|
# rpm packages invert the - and _ and use x86_64 instead of amd64.
|
||||||
|
RPMVERSION=$(echo $VERSION|sed -r 's/-/_/g')
|
||||||
|
RPMARCH=$arch
|
||||||
|
if [ $arch == "amd64" ];then
|
||||||
|
RPMARCH="x86_64"
|
||||||
|
fi
|
||||||
make cloudflared-rpm
|
make cloudflared-rpm
|
||||||
|
mv cloudflared-$RPMVERSION-1.$RPMARCH.rpm $ARTIFACT_DIR/cloudflared-linux-$RPMARCH.rpm
|
||||||
|
|
||||||
|
# finally move the linux binary as well.
|
||||||
|
mv ./cloudflared $ARTIFACT_DIR/cloudflared-linux-$arch
|
||||||
done
|
done
|
||||||
|
|
||||||
mv *.deb $ARTIFACT_DIR
|
|
||||||
mv *.rpm $ARTIFACT_DIR
|
|
||||||
|
|
83
cfsetup.yaml
83
cfsetup.yaml
|
@ -108,20 +108,6 @@ stretch: &stretch
|
||||||
- export GOARCH=amd64
|
- export GOARCH=amd64
|
||||||
- export FIPS=true
|
- export FIPS=true
|
||||||
- make release
|
- make release
|
||||||
github-release-linux-amd64:
|
|
||||||
build_dir: *build_dir
|
|
||||||
builddeps:
|
|
||||||
- *pinned_go_fips
|
|
||||||
- build-essential
|
|
||||||
- python3-setuptools
|
|
||||||
- python3-pip
|
|
||||||
pre-cache: &install_pygithub
|
|
||||||
- pip3 install pygithub
|
|
||||||
post-cache:
|
|
||||||
- export GOOS=linux
|
|
||||||
- export GOARCH=amd64
|
|
||||||
- export FIPS=true
|
|
||||||
- make github-release
|
|
||||||
release-linux-armv6:
|
release-linux-armv6:
|
||||||
build_dir: *build_dir
|
build_dir: *build_dir
|
||||||
builddeps:
|
builddeps:
|
||||||
|
@ -133,20 +119,6 @@ stretch: &stretch
|
||||||
- export GOARCH=arm
|
- export GOARCH=arm
|
||||||
- export CC=arm-linux-gnueabihf-gcc
|
- export CC=arm-linux-gnueabihf-gcc
|
||||||
- make release
|
- make release
|
||||||
github-release-linux-armv6:
|
|
||||||
build_dir: *build_dir
|
|
||||||
builddeps:
|
|
||||||
- *pinned_go
|
|
||||||
- crossbuild-essential-armhf
|
|
||||||
- gcc-arm-linux-gnueabihf
|
|
||||||
- python3-setuptools
|
|
||||||
- python3-pip
|
|
||||||
pre-cache: *install_pygithub
|
|
||||||
post-cache:
|
|
||||||
- export GOOS=linux
|
|
||||||
- export GOARCH=arm
|
|
||||||
- export CC=arm-linux-gnueabihf-gcc
|
|
||||||
- make github-release
|
|
||||||
release-linux-386:
|
release-linux-386:
|
||||||
build_dir: *build_dir
|
build_dir: *build_dir
|
||||||
builddeps:
|
builddeps:
|
||||||
|
@ -156,18 +128,6 @@ stretch: &stretch
|
||||||
- export GOOS=linux
|
- export GOOS=linux
|
||||||
- export GOARCH=386
|
- export GOARCH=386
|
||||||
- make release
|
- make release
|
||||||
github-release-linux-386:
|
|
||||||
build_dir: *build_dir
|
|
||||||
builddeps:
|
|
||||||
- *pinned_go
|
|
||||||
- gcc-multilib
|
|
||||||
- python3-setuptools
|
|
||||||
- python3-pip
|
|
||||||
pre-cache: *install_pygithub
|
|
||||||
post-cache:
|
|
||||||
- export GOOS=linux
|
|
||||||
- export GOARCH=386
|
|
||||||
- make github-release
|
|
||||||
release-windows-amd64:
|
release-windows-amd64:
|
||||||
build_dir: *build_dir
|
build_dir: *build_dir
|
||||||
builddeps:
|
builddeps:
|
||||||
|
@ -178,19 +138,6 @@ stretch: &stretch
|
||||||
- export GOARCH=amd64
|
- export GOARCH=amd64
|
||||||
- export CC=x86_64-w64-mingw32-gcc
|
- export CC=x86_64-w64-mingw32-gcc
|
||||||
- make release
|
- make release
|
||||||
github-release-windows-amd64:
|
|
||||||
build_dir: *build_dir
|
|
||||||
builddeps:
|
|
||||||
- *pinned_go
|
|
||||||
- gcc-mingw-w64
|
|
||||||
- python3-setuptools
|
|
||||||
- python3-pip
|
|
||||||
pre-cache: *install_pygithub
|
|
||||||
post-cache:
|
|
||||||
- export GOOS=windows
|
|
||||||
- export GOARCH=amd64
|
|
||||||
- export CC=x86_64-w64-mingw32-gcc
|
|
||||||
- make github-release
|
|
||||||
release-windows-386:
|
release-windows-386:
|
||||||
build_dir: *build_dir
|
build_dir: *build_dir
|
||||||
builddeps:
|
builddeps:
|
||||||
|
@ -201,40 +148,14 @@ stretch: &stretch
|
||||||
- export GOARCH=386
|
- export GOARCH=386
|
||||||
- export CC=i686-w64-mingw32-gcc-win32
|
- export CC=i686-w64-mingw32-gcc-win32
|
||||||
- make release
|
- make release
|
||||||
github-release-windows-386:
|
|
||||||
build_dir: *build_dir
|
|
||||||
builddeps:
|
|
||||||
- *pinned_go
|
|
||||||
- gcc-mingw-w64
|
|
||||||
- python3-setuptools
|
|
||||||
- python3-pip
|
|
||||||
pre-cache: *install_pygithub
|
|
||||||
post-cache:
|
|
||||||
- export GOOS=windows
|
|
||||||
- export GOARCH=386
|
|
||||||
- export CC=i686-w64-mingw32-gcc-win32
|
|
||||||
- make github-release
|
|
||||||
github-release-linux-arm64:
|
|
||||||
build_dir: *build_dir
|
|
||||||
builddeps:
|
|
||||||
- *pinned_go
|
|
||||||
- crossbuild-essential-armhf
|
|
||||||
- g++-aarch64-linux-gnu
|
|
||||||
- python3-setuptools
|
|
||||||
- python3-pip
|
|
||||||
pre-cache: *install_pygithub
|
|
||||||
post-cache:
|
|
||||||
- export GOOS=linux
|
|
||||||
- export GOARCH=arm64
|
|
||||||
- export CC=aarch64-linux-gnu-gcc
|
|
||||||
- make github-release
|
|
||||||
github-release-macos-amd64:
|
github-release-macos-amd64:
|
||||||
build_dir: *build_dir
|
build_dir: *build_dir
|
||||||
builddeps:
|
builddeps:
|
||||||
- *pinned_go
|
- *pinned_go
|
||||||
- python3-setuptools
|
- python3-setuptools
|
||||||
- python3-pip
|
- python3-pip
|
||||||
pre-cache: *install_pygithub
|
pre-cache: &install_pygithub
|
||||||
|
- pip3 install pygithub
|
||||||
post-cache:
|
post-cache:
|
||||||
- make github-mac-upload
|
- make github-mac-upload
|
||||||
test:
|
test:
|
||||||
|
|
|
@ -197,25 +197,6 @@ def upload_asset(release, filepath, filename, release_version, kv_account_id, na
|
||||||
except shutil.SameFileError:
|
except shutil.SameFileError:
|
||||||
pass # the macOS release copy fails with being the same file (already in the artifacts directory)
|
pass # the macOS release copy fails with being the same file (already in the artifacts directory)
|
||||||
|
|
||||||
def compile_regex() :
|
|
||||||
# The capture groups are:
|
|
||||||
# 1: the text cloudflared
|
|
||||||
# 2: compiled architecture
|
|
||||||
# 3: possible extensions
|
|
||||||
capture_string = r'(cloudflared).+(amd64|x86_64|386|arm)(\.msi|\.deb|\.rpm|\.exe)?'
|
|
||||||
return re.compile(capture_string)
|
|
||||||
|
|
||||||
def extract_filename(regex, filename):
|
|
||||||
match_groups = regex.match(filename)
|
|
||||||
os = "linux"
|
|
||||||
name = match_groups.group(1)
|
|
||||||
arch = match_groups.group(2)
|
|
||||||
ext = match_groups.group(3)
|
|
||||||
if ext in ['.msi', '.exe']:
|
|
||||||
os = "windows"
|
|
||||||
return "{}-{}-{}{}".format(name, os, arch, ext if ext is not None else "")
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
""" Attempts to upload Asset to Github Release. Creates Release if it doesnt exist """
|
""" Attempts to upload Asset to Github Release. Creates Release if it doesnt exist """
|
||||||
try:
|
try:
|
||||||
|
@ -229,11 +210,9 @@ def main():
|
||||||
return
|
return
|
||||||
|
|
||||||
if os.path.isdir(args.path):
|
if os.path.isdir(args.path):
|
||||||
regexp = compile_regex()
|
|
||||||
onlyfiles = [f for f in listdir(args.path) if isfile(join(args.path, f))]
|
onlyfiles = [f for f in listdir(args.path) if isfile(join(args.path, f))]
|
||||||
for filename in onlyfiles:
|
for filename in onlyfiles:
|
||||||
binary_path = os.path.join(args.path, filename)
|
binary_path = os.path.join(args.path, filename)
|
||||||
filename = extract_filename(regexp, filename)
|
|
||||||
upload_asset(release, binary_path, filename, args.release_version, args.kv_account_id, args.namespace_id,
|
upload_asset(release, binary_path, filename, args.release_version, args.kv_account_id, args.namespace_id,
|
||||||
args.kv_api_token)
|
args.kv_api_token)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue