From 7f4f72fb05a09df4c80daffd1ceb9d1ed65f81ce Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Thu, 28 Nov 2019 09:07:49 +0000 Subject: [PATCH] refactored upload --- .travis.yml => .travis.yml.off | 10 ++---- buildScripts/createAppImage | 7 +--- buildScripts/createDockerImage | 2 +- buildScripts/getPdf2htmlEX | 10 +++--- buildScripts/reportEnvs | 27 ++++++++------ buildScripts/travisEnvs | 1 + buildScripts/uploadRelease | 65 ++++++++++++++++++++++++++++++++++ buildScripts/versionEnvs | 11 ++++-- 8 files changed, 100 insertions(+), 33 deletions(-) rename .travis.yml => .travis.yml.off (92%) create mode 100755 buildScripts/uploadRelease diff --git a/.travis.yml b/.travis.yml.off similarity index 92% rename from .travis.yml rename to .travis.yml.off index 3a5ef3a..0cfce99 100644 --- a/.travis.yml +++ b/.travis.yml.off @@ -24,12 +24,6 @@ branches: except: # do not build tags that we create using the upload.sh script - /^(?i:continuous.*)$/ -env: - global: - - UNATTENDED="--assume-yes" - - FORCE_REINSTALL="--reinstall" -## - UPLOADTOOL_SUFFIX="test-$TRAVIS_BRANCH-$(date +%Y_%m_%d-%H_%M_%S)" - #addons: # apt: # update: true @@ -88,7 +82,7 @@ matrix: # - os: osx # Until the build passes, then re-enable. script: - - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin + - ./buildScripts/travisEnvs || travis_terminate 1; - ./buildScripts/reportEnvs || travis_terminate 1; - ./buildScripts/getBuildTools || travis_terminate 1; - ./buildScripts/getDevLibraries || travis_terminate 1; @@ -102,7 +96,7 @@ script: - ./buildScripts/installPdf2htmlEX || travis_terminate 1; - ./buildScripts/createAppImage || travis_terminate 1; - ./buildScripts/createDockerImage || travis_terminate 1; - - docker push $DOCKER_USERNAME/pdf2htmlex + - ./buildScripts/uploadRelease || travis_terminate 1; #deploy: # provider: releases diff --git a/buildScripts/createAppImage b/buildScripts/createAppImage index 3a6b788..3fcbe5a 100755 --- a/buildScripts/createAppImage +++ b/buildScripts/createAppImage @@ -6,8 +6,7 @@ source buildScripts/versionEnvs # For appimage output plugin # -export VERSION="$PDF2HTMLEX_VERSION-$(date +%Y_%m_%d-%H_%M_%S)" -export UPLOADTOOL_BODY="This is the development/testing release of the pdf2htmlEX AppImage.\n\nYou can download the AppImage and 'just run it'.\n\nSee: https://appimage.org/ " +export VERSION="$PDF2HTMLEX_BRANCH-$BUILD_TIME" mkdir -p imageBuild/appDir/usr/lib/ @@ -36,8 +35,4 @@ chmod a+x $LINUX_DEPLOY_APP_IMAGE --appdir=appDir \ --output appimage -wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh - -bash upload.sh pdf2htmlEX*.AppImage - diff --git a/buildScripts/createDockerImage b/buildScripts/createDockerImage index d2247f6..82d33fc 100755 --- a/buildScripts/createDockerImage +++ b/buildScripts/createDockerImage @@ -31,7 +31,7 @@ DOCKERFILE_HERE_DOC cd .. - docker build -t stephengaito/pdf2htmlex:test-`date +%Y_%m_%d-%H_%M_%S` dockerDir + docker build -t $DOCKER_USERNAME/pdf2htmlex:-`date +%Y_%m_%d-%H_%M_%S` dockerDir else echo "Docker is not installed... skipping creation of a docker image." diff --git a/buildScripts/getPdf2htmlEX b/buildScripts/getPdf2htmlEX index a3a375d..2232ad1 100755 --- a/buildScripts/getPdf2htmlEX +++ b/buildScripts/getPdf2htmlEX @@ -3,14 +3,14 @@ # This bash script automates the process of getting the original pdf2htmlEX # source -PDF2HTMLEX_VERSION=newBuildSystem +PDF2HTMLEX_BRANCH=newBuildSystem -wget https://codeload.github.com/stephengaito/pdf2htmlEX/zip/$PDF2HTMLEX_VERSION +wget https://codeload.github.com/stephengaito/pdf2htmlEX/zip/$PDF2HTMLEX_BRANCH -mv $PDF2HTMLEX_VERSION $PDF2HTMLEX_VERSION.zip +mv $PDF2HTMLEX_BRANCH $PDF2HTMLEX_BRANCH.zip sudo apt install unzip -unzip $PDF2HTMLEX_VERSION.zip +unzip $PDF2HTMLEX_BRANCH.zip -mv pdf2htmlEX-$PDF2HTMLEX_VERSION pdf2htmlEX +mv pdf2htmlEX-$PDF2HTMLEX_BRANCH pdf2htmlEX diff --git a/buildScripts/reportEnvs b/buildScripts/reportEnvs index 28e34d1..2ad9167 100755 --- a/buildScripts/reportEnvs +++ b/buildScripts/reportEnvs @@ -3,20 +3,25 @@ # This bash script reports the more important TRAVIS environment variables echo "TravisCI env:" -echo " tag: [$TRAVIS_TAG]" -echo " branch: [$TRAVIS_BRANCH]" -echo " commit: [$TRAVIS_COMMIT]" -echo " build dir: [$TRAVIS_BUILD_DIR]" -echo " repo slug: [$TRAVIS_REPO_SLUG]" +echo " tag: [$TRAVIS_TAG]" +echo " branch: [$TRAVIS_BRANCH]" +echo " commit: [$TRAVIS_COMMIT]" +echo " build dir: [$TRAVIS_BUILD_DIR]" +echo " repo slug: [$TRAVIS_REPO_SLUG]" echo "UploadTool env:" -echo " suffix: [$UPLOADTOOL_SUFFIX]" +echo " suffix: [$UPLOADTOOL_SUFFIX]" source ./buildScripts/versionEnvs echo "pdf2htmlEX env:" -echo " poppler: [$POPPLER_VERSION]" -echo " fontforge: [$FONTFORGE_VERSION]" -echo " pdf2htmlEX: [$PDF2HTMLEX_VERSION]" -echo " docker from: [$DOCKER_FROM]" -echo "machine arch: [$MACHINE_ARCH]" +echo " poppler: [$POPPLER_VERSION]" +echo " fontforge: [$FONTFORGE_VERSION]" +echo " pdf2htmlEX: [$PDF2HTMLEX_BRANCH]" +echo " machine arch: [$MACHINE_ARCH]" + +echo "release env:" +echo " build time: [$BUILD_TIME]" +echo " docker from: [$DOCKER_FROM]" +echo " docker name: [$DOCKER_NAME]" +echo "appImage name: [$APPIMAGE_NAME]" diff --git a/buildScripts/travisEnvs b/buildScripts/travisEnvs index f9e4553..ce997c5 100644 --- a/buildScripts/travisEnvs +++ b/buildScripts/travisEnvs @@ -1,2 +1,3 @@ +export UNATTENDED="--assume-yes" export MAKE_PARALLEL="-j `nproc`" diff --git a/buildScripts/uploadRelease b/buildScripts/uploadRelease new file mode 100755 index 0000000..33f342f --- /dev/null +++ b/buildScripts/uploadRelease @@ -0,0 +1,65 @@ +#!/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) +# UPLOADTOOL_BODY (the text of the github release message) +# + +################################## +# upload github release artefacts +# + +if [ -n "$GITHUB_TOKEN" ]; then + wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh + + echo $BUILD_TIME > buildTime + + echo $APPIMAGE_NAME > appImageName + + echo $DOCKER_NAME > dockerImageName + + if [ -z "$UPLOADTOOL_BODY" ]; then + export UPLOADTOOL_BODY=<