added force signing
continuous-integration/drone/tag Build is passing Details

This commit is contained in:
Paolo Asperti 2022-07-19 12:04:13 +02:00
parent 72af48d017
commit ed99be0c84
Signed by: paspo
GPG Key ID: 06D46905D19D5182
1 changed files with 7 additions and 7 deletions

14
run.sh
View File

@ -30,19 +30,19 @@ TMPDIR=$( mktemp -d )
UPLOADDIRNAME=$( head /dev/urandom | tr -dc A-Za-z0-9 | head -c 16 )
NETRC=$( mktemp )
if [ -z "${HTTP_USER}" || -z "${HTTP_PASS}" ] ; then
if [ -z "${HTTP_USER}" ] || [ -z "${HTTP_PASS}" ] ; then
AUTH=""
else
HOST=$(echo "$API_URL" | sed -E 's/^https?\:\/\/(.*)\/.*/\1/g' )
echo "machine ${HOST} login ${HTTP_USER} password ${HTTP_PASS}" > $NETRC
echo "machine ${HOST} login ${HTTP_USER} password ${HTTP_PASS}" > "$NETRC"
AUTH="--netrc-file ${NETRC}"
fi
# maybe do this better, it can lead to unwanted word splitting
cp -r $( echo "${FILES}" | sed 's/\([^\\]\)\,/\1 /g' ) "${TMPDIR}/"
cp -r $( echo "${FILES}" | sed 's/\([^\\]\)\,/\1 /g' ) "${TMPDIR}/"
cd "${TMPDIR}"
for file in *.deb ; do
cd "${TMPDIR}" || exit
for file in *.deb ; do
echo "uploading '$file' to remote directory '${UPLOADDIRNAME}'"
curl ${AUTH} -X POST -F "file=@${file}" "${API_URL}/files/${UPLOADDIRNAME}"
done
@ -50,8 +50,8 @@ done
echo "Adding files to ${REPO}"
curl ${AUTH} -X POST "${API_URL}/repos/${REPO}/file/${UPLOADDIRNAME}"
if [ ! -z "${PASSPHRASE}" ] ; then
if [ -n "${PASSPHRASE}" ] ; then
echo "Signing and publishing ${REPO}"
curl ${AUTH} -X PUT -H 'Content-Type: application/json' --data "{\"Signing\": {\"Passphrase\": \"${PASSPHRASE}\", \"Batch\":true}}" "${API_URL}/publish/:./${DISTRIBUTION}"
curl ${AUTH} -X PUT -H 'Content-Type: application/json' --data "{\"Signing\": {\"Passphrase\": \"${PASSPHRASE}\", \"Batch\":true}, \"ForceOverwrite\": true}" "${API_URL}/publish/:./${DISTRIBUTION}"
fi