-
Notifications
You must be signed in to change notification settings - Fork 2
/
publish_dist.sh
executable file
·43 lines (35 loc) · 1.39 KB
/
publish_dist.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env bash
#
# Uploads dist packages to testing/ on Chevah's server, then shows final links.
# To be used through GitHub actions.
# Bash checks
set -o nounset # always check if variables exist
set -o errexit # always exit on error
set -o errtrace # trap errors in functions as well
set -o pipefail # don't ignore exit codes when piping output
dest_server="bin.chevah.com"
dest_user="github-upload"
root_link="https://${dest_server}:20443"
# The build/publish_dist_sftp_batch file is generated by the build process.
# The private key comes from GitHub Secrets through the configured workflow.
sftp_opts="-b build/publish_dist_sftp_batch -o IdentityFile=priv_key \
-o StrictHostKeyChecking=yes"
# Get $OS, $ARCH vars and set sftp command accordingly.
source BUILD_ENV_VARS
case $OS in
win)
# To use an RSA key, upstream SFTP is installed through GitHub actions.
sftp_cmd="/c/Progra~1/OpenSSH-Win64/sftp.exe"
;;
*)
sftp_cmd="sftp"
;;
esac
$sftp_cmd $sftp_opts ${dest_user}@${dest_server}
# Unlike with pythia repo, DIST_FOLDER & UPLOAD_FOLDER come from BUILD_ENV_VARS.
dist_dir="$DIST_FOLDER"
upload_dir="$UPLOAD_FOLDER"
pkg_name=$(cd ${dist_dir}/python/${OS}/${ARCH}/ && ls -1)
# Local hierarchy matches the remote one.
echo "Package $pkg_name uploaded to: ${root_link}/${upload_dir}/"
echo "Direct link: ${root_link}/${upload_dir}/${pkg_name}"