Skip to content

Commit cd4af56

Browse files
TUN-4772: Release built executables with packages
1 parent 8527d03 commit cd4af56

File tree

3 files changed

+18
-105
lines changed

3 files changed

+18
-105
lines changed

build-packages.sh

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
VERSION=$(git describe --tags --always --dirty="-dev" --match "[0-9][0-9][0-9][0-9].*.*")
2+
echo $VERSION
13
export CGO_ENABLED=0
24
# This controls the directory the built artifacts go into
35
export ARTIFACT_DIR=built_artifacts/
@@ -7,18 +9,29 @@ export TARGET_OS=windows
79
for arch in ${windowsArchs[@]}; do
810
export TARGET_ARCH=$arch
911
make cloudflared-msi
12+
mv ./cloudflared.exe $ARTIFACT_DIR/cloudflared-windows-$arch.exe
13+
mv cloudflared-$VERSION-$arch.msi $ARTIFACT_DIR/cloudflared-windows-$arch.msi
1014
done
1115

12-
mv *.msi $ARTIFACT_DIR
1316

1417
export FIPS=true
1518
linuxArchs=("amd64" "386" "arm")
1619
export TARGET_OS=linux
1720
for arch in ${linuxArchs[@]}; do
1821
export TARGET_ARCH=$arch
1922
make cloudflared-deb
23+
mv cloudflared\_$VERSION\_$arch.deb $ARTIFACT_DIR/cloudflared-linux-$arch.deb
24+
25+
# rpm packages invert the - and _ and use x86_64 instead of amd64.
26+
RPMVERSION=$(echo $VERSION|sed -r 's/-/_/g')
27+
RPMARCH=$arch
28+
if [ $arch == "amd64" ];then
29+
RPMARCH="x86_64"
30+
fi
2031
make cloudflared-rpm
32+
mv cloudflared-$RPMVERSION-1.$RPMARCH.rpm $ARTIFACT_DIR/cloudflared-linux-$RPMARCH.rpm
33+
34+
# finally move the linux binary as well.
35+
mv ./cloudflared $ARTIFACT_DIR/cloudflared-linux-$arch
2136
done
2237

23-
mv *.deb $ARTIFACT_DIR
24-
mv *.rpm $ARTIFACT_DIR

cfsetup.yaml

Lines changed: 2 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -108,20 +108,6 @@ stretch: &stretch
108108
- export GOARCH=amd64
109109
- export FIPS=true
110110
- make release
111-
github-release-linux-amd64:
112-
build_dir: *build_dir
113-
builddeps:
114-
- *pinned_go_fips
115-
- build-essential
116-
- python3-setuptools
117-
- python3-pip
118-
pre-cache: &install_pygithub
119-
- pip3 install pygithub
120-
post-cache:
121-
- export GOOS=linux
122-
- export GOARCH=amd64
123-
- export FIPS=true
124-
- make github-release
125111
release-linux-armv6:
126112
build_dir: *build_dir
127113
builddeps:
@@ -133,20 +119,6 @@ stretch: &stretch
133119
- export GOARCH=arm
134120
- export CC=arm-linux-gnueabihf-gcc
135121
- make release
136-
github-release-linux-armv6:
137-
build_dir: *build_dir
138-
builddeps:
139-
- *pinned_go
140-
- crossbuild-essential-armhf
141-
- gcc-arm-linux-gnueabihf
142-
- python3-setuptools
143-
- python3-pip
144-
pre-cache: *install_pygithub
145-
post-cache:
146-
- export GOOS=linux
147-
- export GOARCH=arm
148-
- export CC=arm-linux-gnueabihf-gcc
149-
- make github-release
150122
release-linux-386:
151123
build_dir: *build_dir
152124
builddeps:
@@ -156,18 +128,6 @@ stretch: &stretch
156128
- export GOOS=linux
157129
- export GOARCH=386
158130
- make release
159-
github-release-linux-386:
160-
build_dir: *build_dir
161-
builddeps:
162-
- *pinned_go
163-
- gcc-multilib
164-
- python3-setuptools
165-
- python3-pip
166-
pre-cache: *install_pygithub
167-
post-cache:
168-
- export GOOS=linux
169-
- export GOARCH=386
170-
- make github-release
171131
release-windows-amd64:
172132
build_dir: *build_dir
173133
builddeps:
@@ -178,19 +138,6 @@ stretch: &stretch
178138
- export GOARCH=amd64
179139
- export CC=x86_64-w64-mingw32-gcc
180140
- make release
181-
github-release-windows-amd64:
182-
build_dir: *build_dir
183-
builddeps:
184-
- *pinned_go
185-
- gcc-mingw-w64
186-
- python3-setuptools
187-
- python3-pip
188-
pre-cache: *install_pygithub
189-
post-cache:
190-
- export GOOS=windows
191-
- export GOARCH=amd64
192-
- export CC=x86_64-w64-mingw32-gcc
193-
- make github-release
194141
release-windows-386:
195142
build_dir: *build_dir
196143
builddeps:
@@ -201,40 +148,14 @@ stretch: &stretch
201148
- export GOARCH=386
202149
- export CC=i686-w64-mingw32-gcc-win32
203150
- make release
204-
github-release-windows-386:
205-
build_dir: *build_dir
206-
builddeps:
207-
- *pinned_go
208-
- gcc-mingw-w64
209-
- python3-setuptools
210-
- python3-pip
211-
pre-cache: *install_pygithub
212-
post-cache:
213-
- export GOOS=windows
214-
- export GOARCH=386
215-
- export CC=i686-w64-mingw32-gcc-win32
216-
- make github-release
217-
github-release-linux-arm64:
218-
build_dir: *build_dir
219-
builddeps:
220-
- *pinned_go
221-
- crossbuild-essential-armhf
222-
- g++-aarch64-linux-gnu
223-
- python3-setuptools
224-
- python3-pip
225-
pre-cache: *install_pygithub
226-
post-cache:
227-
- export GOOS=linux
228-
- export GOARCH=arm64
229-
- export CC=aarch64-linux-gnu-gcc
230-
- make github-release
231151
github-release-macos-amd64:
232152
build_dir: *build_dir
233153
builddeps:
234154
- *pinned_go
235155
- python3-setuptools
236156
- python3-pip
237-
pre-cache: *install_pygithub
157+
pre-cache: &install_pygithub
158+
- pip3 install pygithub
238159
post-cache:
239160
- make github-mac-upload
240161
test:

github_release.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -197,25 +197,6 @@ def upload_asset(release, filepath, filename, release_version, kv_account_id, na
197197
except shutil.SameFileError:
198198
pass # the macOS release copy fails with being the same file (already in the artifacts directory)
199199

200-
def compile_regex() :
201-
# The capture groups are:
202-
# 1: the text cloudflared
203-
# 2: compiled architecture
204-
# 3: possible extensions
205-
capture_string = r'(cloudflared).+(amd64|x86_64|386|arm)(\.msi|\.deb|\.rpm|\.exe)?'
206-
return re.compile(capture_string)
207-
208-
def extract_filename(regex, filename):
209-
match_groups = regex.match(filename)
210-
os = "linux"
211-
name = match_groups.group(1)
212-
arch = match_groups.group(2)
213-
ext = match_groups.group(3)
214-
if ext in ['.msi', '.exe']:
215-
os = "windows"
216-
return "{}-{}-{}{}".format(name, os, arch, ext if ext is not None else "")
217-
218-
219200
def main():
220201
""" Attempts to upload Asset to Github Release. Creates Release if it doesnt exist """
221202
try:
@@ -229,11 +210,9 @@ def main():
229210
return
230211

231212
if os.path.isdir(args.path):
232-
regexp = compile_regex()
233213
onlyfiles = [f for f in listdir(args.path) if isfile(join(args.path, f))]
234214
for filename in onlyfiles:
235215
binary_path = os.path.join(args.path, filename)
236-
filename = extract_filename(regexp, filename)
237216
upload_asset(release, binary_path, filename, args.release_version, args.kv_account_id, args.namespace_id,
238217
args.kv_api_token)
239218
else:

0 commit comments

Comments
 (0)