From 41e8218f6576d3f75bc9bc6406db7bdc3249e7e4 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 29 Nov 2019 07:28:23 +0000 Subject: [PATCH] refactored upload process --- buildScripts/buildInstallLocally | 41 ++++++++++ buildScripts/{doItAll => doItAllLocally} | 1 - buildScripts/uploadRelease | 96 ++++++++++++++++-------- buildScripts/versionEnvs | 1 - 4 files changed, 104 insertions(+), 35 deletions(-) create mode 100755 buildScripts/buildInstallLocally rename buildScripts/{doItAll => doItAllLocally} (97%) diff --git a/buildScripts/buildInstallLocally b/buildScripts/buildInstallLocally new file mode 100755 index 0000000..4c0a3d3 --- /dev/null +++ b/buildScripts/buildInstallLocally @@ -0,0 +1,41 @@ +#!/bin/bash + +# This bash script builds the complete pdf2htmlEX application LOCALLY +# (It does not create the AppImage or Docker images) + +# Adjust the following two environment variables to suit your needs +# +export UNATTENDED="--assume-yes" +export MAKE_PARALLEL="-j $(nproc)" + +# choose one of the following... +# +export PDF2HTMLEX_BRANCH=newBuildSystem +# export PDF2HTMLEX_BRANCH="$(git rev-parse --abbrev-ref HEAD)" + +################ +# do the build + +./buildScripts/versionEnvs || { echo 'versionEnvs FAILED' ; exit 1 ; } + +./buildScripts/reportEnvs || { echo 'reportEnvs FAILED' ; exit 1 ; } + +./buildScripts/getBuildTools || { echo 'getBuildTools FAILED' ; exit 1 ; } + +./buildScripts/getDevLibraries || { echo 'getDevLibraries FAILED' ; exit 1 ; } + +./buildScripts/getPoppler || { echo 'getPoppler FAILED' ; exit 1 ; } + +./buildScripts/buildPoppler || { echo 'buildPoppler FAILED' ; exit 1 ; } + +./buildScripts/installPoppler || { echo 'installPoppler FAILED' ; exit 1 ; } + +./buildScripts/getFontforge || { echo 'getFontforge FAILED' ; exit 1 ; } + +./buildScripts/buildFontforge || { echo 'buildFontforge FAILED' ; exit 1 ; } + +./buildScripts/installFontforge || { echo 'installFontforge FAILED' ; exit 1 ; } + +./buildScripts/buildPdf2htmlEX || { echo 'buildPdf2htmlEX FAILED' ; exit 1 ; } + +./buildScripts/installPdf2htmlEX || { echo 'installPdf2htmlEX FAILED' ; exit 1 ; } diff --git a/buildScripts/doItAll b/buildScripts/doItAllLocally similarity index 97% rename from buildScripts/doItAll rename to buildScripts/doItAllLocally index b434a06..adeefcf 100755 --- a/buildScripts/doItAll +++ b/buildScripts/doItAllLocally @@ -7,7 +7,6 @@ # export UNATTENDED="--assume-yes" export MAKE_PARALLEL="-j $(nproc)" -export TRAVIS_REPO_SLUG=stephengaito/pdf2htmlEX # choose one of the following... # diff --git a/buildScripts/uploadRelease b/buildScripts/uploadRelease index 126102c..4b52d3c 100755 --- a/buildScripts/uploadRelease +++ b/buildScripts/uploadRelease @@ -16,54 +16,84 @@ source ./buildScripts/reSourceVersionEnvs # upload github release artefacts # +# 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 + +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 + +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 + cd imageBuild -if [ -n "$GITHUB_TOKEN" ]; then +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 - 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 +echo $BUILD_TIME > buildTime +echo $APPIMAGE_NAME > appImageName +echo $DOCKER_NAME > dockerImageName - echo $BUILD_TIME > buildTime +echo ../buildScripts/uploadReleaseTool "$TRAVIS_REPO_SLUG" "continuous" "Latest release" \ + -- $APPIMAGE_NAME appImageName dockerImageName buildTime - echo $APPIMAGE_NAME > appImageName +../buildScripts/uploadReleaseTool "$TRAVIS_REPO_SLUG" "continuous" "Latest release" \ + -- $APPIMAGE_NAME appImageName dockerImageName buildTime - echo $DOCKER_NAME > dockerImageName - - echo ../buildScripts/uploadReleaseTool "$TRAVIS_REPO_SLUG" "continuous" "Latest release" \ - -- $APPIMAGE_NAME appImageName dockerImageName buildTime - - ../buildScripts/uploadReleaseTool "$TRAVIS_REPO_SLUG" "continuous" "Latest release" \ - -- $APPIMAGE_NAME appImageName dockerImageName buildTime - -else - echo "GITHUB_TOKEN not set... so we can not upload release artefacts." -fi ################################## # push docker image # if [ -x "$(which docker)" ]; then - if [ -n "$DOCKER_USERNAME" ]; then - - if [ -z "$DOCKER_PASSWORD" ]; then - echo "" - echo "Please type your the Docker hub password" - docker login -u "$DOCKER_USERNAME" - else - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin + 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 fi - - docker push $DOCKER_USERNAME/pdf2htmlex - - else - echo "DOCKER_USERNAME not set... so we do not know where to push image." fi + if [ -z "$DOCKER_PASSWORD" ]; then + echo "" + echo "Please type your the Docker hub password" + docker login -u "$DOCKER_USERNAME" + else + echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin + fi + + docker push $DOCKER_USERNAME/pdf2htmlex + else echo "Docker is not installed... skipping upload of docker image." fi diff --git a/buildScripts/versionEnvs b/buildScripts/versionEnvs index 9103687..0c11cf9 100755 --- a/buildScripts/versionEnvs +++ b/buildScripts/versionEnvs @@ -31,5 +31,4 @@ echo "export BUILD_TIME=\"$BUILD_TIME\"" >> buildScripts/reSourceV echo "export DOCKER_FROM=\"$DOCKER_FROM\"" >> buildScripts/reSourceVersionEnvs echo "export DOCKER_NAME=\"$DOCKER_NAME\"" >> buildScripts/reSourceVersionEnvs echo "export APPIMAGE_NAME=\"$APPIMAGE_NAME\"" >> buildScripts/reSourceVersionEnvs -echo "export TRAVIS_REPO_SLUG=\"$TRAVIS_REPO_SLUG\"" >> buildScripts/reSourceVersionEnvs