aboutsummaryrefslogtreecommitdiff
path: root/bin/release-ftp.sh
diff options
context:
space:
mode:
Diffstat (limited to 'bin/release-ftp.sh')
-rwxr-xr-xbin/release-ftp.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/bin/release-ftp.sh b/bin/release-ftp.sh
new file mode 100755
index 0000000..8837a22
--- /dev/null
+++ b/bin/release-ftp.sh
@@ -0,0 +1,38 @@
+#! /usr/bin/env sh
+
+readonly DISTNAME="rakudo-star-$CI_COMMIT_REF_NAME"
+
+main()
+{
+ if list_releases | grep -Fq "$DISTNAME"
+ then
+ printf "A release named %s already exists!\n" "$DISTNAME"
+ exit 1
+ fi
+
+ upload_release
+}
+
+list_releases()
+{
+ lftp -e <<-EOI
+ open $FTP_HOST:${FTP_PORT:-21};
+ user sftp://$FTP_USER $FTP_PASSWORD;
+ cd ${FTP_DIR:-rakudo-star};
+ ls;
+ bye;
+ EOI
+}
+
+upload_release()
+{
+ lftp -e <<-EOI
+ open $FTP_HOST:${FTP_PORT:-21};
+ user sftp://$FTP_USER $FTP_PASSWORD;
+ cd ${FTP_DIR:-rakudo-star};
+ put work/release/rakudo-star-$CI_COMMIT_REF_NAME;
+ bye;
+ EOI
+}
+
+main "$@"