Publish script update with versio file not existing check

This commit is contained in:
Clemens Schwaighofer
2024-04-16 18:27:43 +09:00
parent 24eb2c2bee
commit e8f4c82f59

View File

@@ -56,10 +56,14 @@ if [ ! -z "${GITEA_UPLOAD_FILENAME}" ] &&
curl -LJO \
--output-dir "${PACKAGE_DOWNLOAD}" \
${GITEA_URL_DL}/v${VERSION}.zip;
curl --user ${GITEA_USER}:${GITEA_TOKEN} \
--upload-file "${PACKAGE_DOWNLOAD}${GITEA_UPLOAD_FILENAME}-v${VERSION}.zip" \
${GITEA_URL_PUSH}?version=${VERSION};
echo "${VERSION}" > "${file_last_published}";
if [ -f "${PACKAGE_DOWNLOAD}${GITEA_UPLOAD_FILENAME}-v${VERSION}.zip" ]; then
print "Version file does not exist for ${VERSION}";
else
curl --user ${GITEA_USER}:${GITEA_TOKEN} \
--upload-file "${PACKAGE_DOWNLOAD}${GITEA_UPLOAD_FILENAME}-v${VERSION}.zip" \
${GITEA_URL_PUSH}?version=${VERSION};
echo "${VERSION}" > "${file_last_published}";
fi;
else
echo "Missing either GITEA_UPLOAD_FILENAME, GITEA_URL_DL, GITEA_URL_PUSH, GITEA_USER or GITEA_TOKEN environment variable";
fi;