1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-07-04 17:18:40 +00:00
pdf2htmlEX/buildScripts/uploadGitHubRelease

112 lines
3.0 KiB
Plaintext
Raw Normal View History

2019-11-28 09:07:49 +00:00
#!/bin/bash
# This bash script uploads the pdf2htmlEX release artefacts
#
# We EXPECT the following environment variables to be set:
# GITHUB_TOKEN
# DOCKER_USERNAME
#
# You can OPTIONALLY set the following environment variables:
# DOCKER_PASSWORD (if not set you will be asked for your password)
#
2019-11-28 12:04:22 +00:00
source ./buildScripts/reSourceVersionEnvs
source ./buildScripts/uploadReleaseDSL
echo ""
echo "-------------------------------------------------------------------"
echo "UPLOADING pdf2htmlEX AppImage and Docker Images"
echo "-------------------------------------------------------------------"
echo ""
2019-11-28 12:04:22 +00:00
2019-11-28 09:07:49 +00:00
##################################
# upload github release artefacts
#
2019-11-29 07:28:23 +00:00
# begin by gathering the required environment variables
#
if [ -z "$GITHUB_USERNAME" ]; then
echo ""
read -p "Enter the GitHub upload username: " GITHUB_USERNAME
echo ""
if [ -z "$GITHUB_USERNAME" ]; then
echo "GITHUB_USERNAME not set... so we can not upload release artefacts."
exit 1
fi
fi
2019-11-28 12:04:22 +00:00
2019-11-29 07:28:23 +00:00
if [ -z "$GITHUB_TOKEN" ]; then
echo ""
read -p "Enter the GitHub upload token/password: " GITHUB_TOKEN
echo ""
if [ -z "$GITHUB_TOKEN" ]; then
echo "GITHUB_TOKEN not set... so we can not upload release artefacts."
exit 1
fi
fi
2019-11-29 07:28:23 +00:00
if [ -z "$TRAVIS_REPO_SLUG" ]; then
echo ""
read -p "Enter the GitHub repository (user/proj): " TRAVIS_REPO_SLUG
echo ""
if [ -z "$TRAVIS_REPO_SLUG" ]; then
echo "TRAVIS_REPO_SLUG (Github repository) not set... so we can not upload release artefacts."
exit 1
fi
fi
2019-11-28 09:07:49 +00:00
2019-11-29 07:28:23 +00:00
cd imageBuild
2019-11-28 09:07:49 +00:00
2019-11-29 07:28:23 +00:00
echo "machine api.github.com" > $HOME/.netrc
echo " login $GITHUB_USERNAME" >> $HOME/.netrc
echo " password $GITHUB_TOKEN" >> $HOME/.netrc
echo "machine uploads.github.com" >> $HOME/.netrc
echo " login $GITHUB_USERNAME" >> $HOME/.netrc
echo " password $GITHUB_TOKEN" >> $HOME/.netrc
2019-11-28 09:07:49 +00:00
echo $BUILD_TIME > buildTime
2019-11-29 07:28:23 +00:00
echo $APPIMAGE_NAME > appImageName
echo $DOCKER_NAME > dockerImageName
2019-11-28 09:07:49 +00:00
deleteReleaseByTag "$TRAVIS_REPO_SLUG" "continuous"
2019-11-28 19:13:40 +00:00
createNewRelease "$TRAVIS_REPO_SLUG" "continuous" "Latest release" \
2019-11-29 09:43:07 +00:00
../buildScripts/uploadGitHubReleaseMessage
2019-11-28 09:07:49 +00:00
uploadAnAsset $upload_url appImageName "text/plain"
uploadAnAsset $upload_url buildTime "text/plain"
uploadAnAsset $upload_url dockerImageName "text/plain"
uploadAnAsset $upload_url $APPIMAGE_NAME "application/zip"
2019-11-28 09:07:49 +00:00
##################################
# push docker image
#
if [ -x "$(which docker)" ]; then
2019-11-29 07:28:23 +00:00
if [ -z "$DOCKER_USERNAME" ]; then
echo ""
read -p "Enter the Docker usernane): " DOCKER_USERNAME
echo ""
if [ -z "$DOCKER_USERNAME" ]; then
echo "DOCKER_USERNAME not set... so we do not know where to push image."
exit 1
2019-11-28 09:07:49 +00:00
fi
2019-11-29 07:28:23 +00:00
fi
2019-11-28 09:07:49 +00:00
2019-11-29 07:28:23 +00:00
if [ -z "$DOCKER_PASSWORD" ]; then
echo ""
echo "Please type your the Docker hub password"
docker login -u "$DOCKER_USERNAME"
2019-11-28 09:07:49 +00:00
else
2019-11-29 07:28:23 +00:00
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
2019-11-28 09:07:49 +00:00
fi
2019-11-29 07:28:23 +00:00
docker push $DOCKER_USERNAME/pdf2htmlex
2019-11-28 09:07:49 +00:00
else
echo "Docker is not installed... skipping upload of docker image."
fi