#!/bin/sh

cd `dirname $0`/../dist
rm -f release-files.txt
touch release-files.txt

for file in *.deb
do
	# The filename can contain only lowercase letters (a-z), uppercase letter (A-Z), numbers (0-9), dots (.),
	# hyphens (-), or underscores (_).
	filename=`echo $file|tr '~' '_'|tr '+' '_'|sed s/[^a-zA-Z0-9\.\_\-]//g`
	https --ignore-stdin --check-status PUT "${PACKAGE_REGISTRY_URL}/${filename}" "JOB-TOKEN: $CI_JOB_TOKEN" "@$file"
	echo $filename >> release-files.txt
done
