diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..a66443660 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,58 @@ +name: Build and deploy JPEXS FFDec + +on: + push: + branches: + - dev + - master + pull_request: + branches: + - dev + - master + +env: + CICD_REPO_SLUG: jindrapetrik/jpexs-decompiler + CICD_REFTYPE: ${{ github.ref_type }} + CICD_REFNAME: ${{ github.ref_name }} + CICD_COMMIT: ${{ github.sha }} + CICD_NAME: GitHub Actions + CICD_EMAIL: GitHub + CICD_EVENTNAME: ${{ github.event_name }} + NIGHTLY_BRANCH: dev + GITHUB_USER: jindrapetrik + GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +jobs: + build: + + runs-on: ubuntu-latest + container: debian:sid + + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up JDK 1.8 + uses: actions/setup-java@v3 + with: + java-version: 8 + distribution: temurin + - name: Set up PHP + run: | + apt update -y -qq + apt install -y -qq php + - name: Set up NSis + run: | + bash -c 'echo "deb http://ftp.debian.org/debian unstable main contrib non-free" >> /etc/apt/sources.list.d/unstable.list' + apt-get -y update + apt-get -y install -t unstable nsis + makensis -VERSION + - name: Set up ant + run: | + apt install -y -qq ant + - name: Build + run: | + export CICD_TEMP=${{ runner.temp }} + chmod a+x ./cicd_scripts/*.sh + ./cicd_scripts/before_install.sh + ./cicd_scripts/install.sh + ./cicd_scripts/script.sh diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index b7cc25a4f..000000000 --- a/.travis.yml +++ /dev/null @@ -1,27 +0,0 @@ -language: java -jdk: [openjdk8] -#dist: trusty -addons: - apt: - packages: - - ant -before_install: - - sudo chmod a+x ./travis/*.sh - - "./travis/before_install.sh" -install: "./travis/install.sh" -script: "source ./travis/script.sh" -cache: - directories: - - /home/travis/tools -notifications: - email: - recipients: - - developers@free-decompiler.com - on_success: change - on_failure: always -after_success: "source ./travis/after_success.sh" -branches: - #it is not tagged as nightly - #commits marked as nightly were already built - only: - - /^(?!nightly).*/ \ No newline at end of file diff --git a/build.properties b/build.properties index d48a133e7..b342c1630 100644 --- a/build.properties +++ b/build.properties @@ -93,4 +93,4 @@ dist.lib.dirname = lib javadoc.dir = javadoc ant.lib.dir = antlib -adobe.playerglobal.path = travis/tools/playerglobal32_0.swc \ No newline at end of file +adobe.playerglobal.path = cicd_scripts/tools/playerglobal32_0.swc \ No newline at end of file diff --git a/build.xml b/build.xml index 900b2c7b8..9316cf37e 100644 --- a/build.xml +++ b/build.xml @@ -175,7 +175,7 @@ - + + + + + + + + + + + + + @@ -598,7 +611,7 @@ - + diff --git a/cicd_scripts/before_install.sh b/cicd_scripts/before_install.sh new file mode 100644 index 000000000..39c73e44e --- /dev/null +++ b/cicd_scripts/before_install.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +# Exit immediately on first error +set -e +apt-get -qq update +apt-get install -y jq +apt-get install -y curl + +tools_dir=$CICD_TEMP/tools + +if [ ! -f "$tools_dir/cached.txt" ]; then + # create directory where tools will be downloaded and installed + mkdir -p $tools_dir + + echo "cached">$tools_dir/cached.txt + + #Extract launch4j - tool for creating EXE file from Java + cp ./cicd_scripts/tools/launch4j-3.14-linux-x64.tgz ./ + tar zxvf launch4j-3.14-linux-x64.tgz -C "$tools_dir" >/dev/null +fi + +#Create tools.properties with paths to NSIS and launch4j + +MAKENSIS_FULLPATH=`which makensis` +MAKENSIS_PATH=`dirname "$MAKENSIS_FULLPATH"` + +echo "nsis.path = $MAKENSIS_PATH" > tools.properties +echo "launch4j.path = $tools_dir/launch4j" >> tools.properties + +cat tools.properties + +# Secure variable $website_password is not available from outside +# of jpexs repository (e.g pull requests from other users on GitHub) +if ! [ -z ${website_password+x} ]; then + # Store username and password for uploading releases to jpexs server + echo "username=$website_user" > jpexs_website.properties + echo "password=$website_password" >> jpexs_website.properties +fi diff --git a/travis/check_issue_references.php b/cicd_scripts/check_issue_references.php similarity index 100% rename from travis/check_issue_references.php rename to cicd_scripts/check_issue_references.php diff --git a/travis/check_references.php b/cicd_scripts/check_references.php similarity index 100% rename from travis/check_references.php rename to cicd_scripts/check_references.php diff --git a/travis/format_release_info.php b/cicd_scripts/format_release_info.php similarity index 100% rename from travis/format_release_info.php rename to cicd_scripts/format_release_info.php diff --git a/travis/install.sh b/cicd_scripts/install.sh similarity index 100% rename from travis/install.sh rename to cicd_scripts/install.sh diff --git a/cicd_scripts/script.sh b/cicd_scripts/script.sh new file mode 100644 index 000000000..8682bc703 --- /dev/null +++ b/cicd_scripts/script.sh @@ -0,0 +1,176 @@ +#!/usr/bin/env bash +#stop on error +set -e + +VERSION_PROP_FILE="version.properties" + +# If we've got website password, we can upload nightly builds. +# CICD secure variable $website_password is not available from outside +# of jpexs repository (e.g pull requests from other users on GitHub) + +if [ -z ${GITHUB_ACCESS_TOKEN+x} ]; then + # password not set, just make private release without publishing result + echo "No password set, making private release..." + ant all +else + # if tag set + if [ $CICD_REFTYPE = "tag" ]; then + #tag starts with "version" prefix + if [[ $CICD_REFNAME =~ ^version.* ]] ; then + echo "Version tag, creating new version..." + + #generate prop file + VERSION_NUMBER=`echo $CICD_REFNAME|sed 's/version//'` + + VERSION_MAJOR=`echo $VERSION_NUMBER|cut -d '.' -f 1` + VERSION_MINOR=`echo $VERSION_NUMBER|cut -d '.' -f 2` + VERSION_RELEASE=`echo $VERSION_NUMBER|cut -d '.' -f 3` + + echo "">$VERSION_PROP_FILE + echo "major=$VERSION_MAJOR">>$VERSION_PROP_FILE + echo "minor=$VERSION_MINOR">>$VERSION_PROP_FILE + echo "release=$VERSION_RELEASE">>$VERSION_PROP_FILE + echo "build=0">>$VERSION_PROP_FILE + echo "revision=$CICD_COMMIT">>$VERSION_PROP_FILE + echo "debug=false">>$VERSION_PROP_FILE + + #compile, build, create files + ant new-version + + # release standard version based on tag + export DEPLOY_TAG_NAME=$CICD_REFNAME + export DEPLOY_VERSION_NAME="version $VERSION_NUMBER" + export DEPLOY_DESCRIPTION=`php ./cicd_scripts/format_release_info.php -filever $VERSION_NUMBER $VERSION_NUMBER $DEPLOY_TAG_NAME ./CHANGELOG.md "$CICD_REPO_SLUG"` + export DEPLOY_COMMITISH="master" + export DEPLOY_PRERELEASE=false + export DEPLOY_FILEVER_TAG="$VERSION_NUMBER" + export DO_DEPLOY=1 + else + # regular build + echo "Other tag, regular build..." + ant all + fi + else + #if we are on $NIGHTLY_BRANCH branch and it's not a pull request + if [ "$CICD_REFNAME" == "$NIGHTLY_BRANCH" ] && [ "$CICD_EVENTNAME" != "pull_request" ]; then + echo "On $NIGHTLY_BRANCH branch and no pull request, creating nightly..." + # create nightly build... + + TAGGER_NAME=$CICD_NAME + TAGGER_EMAIL=$CICD_EMAIL + + TAG_COMMIT_HASH=$CICD_COMMIT + GITHUB_REPO=$CICD_REPO_SLUG + echo "Getting new version tag and name..." + RELEASES_JSON=`curl --silent --request GET --header "Accept: application/vnd.github.manifold-preview" --user $GITHUB_USER:$GITHUB_ACCESS_TOKEN https://api.github.com/repos/$GITHUB_REPO/releases` + LAST_NIGHTLY_VER=`echo $RELEASES_JSON|jq --raw-output '.[].tag_name'|grep 'nightly'|sed 's/nightly//'|head -n 1` + LAST_STABLE_VER=`echo $RELEASES_JSON|jq --raw-output '.[].tag_name'|grep 'version'|sed 's/version//'|head -n 1` + NEXT_NIGHTLY_VER=$(($LAST_NIGHTLY_VER+1)) + LAST_NIGHTLY_TAG=nightly$LAST_NIGHTLY_VER + NEXT_NIGHTLY_TAG=nightly$NEXT_NIGHTLY_VER + + + #generate prop file + VERSION_NUMBER=$LAST_STABLE_VER + VERSION_MAJOR=`echo $VERSION_NUMBER|cut -d '.' -f 1` + VERSION_MINOR=`echo $VERSION_NUMBER|cut -d '.' -f 2` + VERSION_RELEASE=`echo $VERSION_NUMBER|cut -d '.' -f 3` + + echo "">$VERSION_PROP_FILE + echo "major=$VERSION_MAJOR">>$VERSION_PROP_FILE + echo "minor=$VERSION_MINOR">>$VERSION_PROP_FILE + echo "release=$VERSION_RELEASE">>$VERSION_PROP_FILE + echo "build=$NEXT_NIGHTLY_VER">>$VERSION_PROP_FILE + echo "revision=$CICD_COMMIT">>$VERSION_PROP_FILE + echo "debug=true">>$VERSION_PROP_FILE + + #compile, build, create files + ant new-version + + CURRENT_DATE=`date +%Y-%m-%dT%H:%M:%SZ` + + ESC_TAGGER_NAME=`echo $TAGGER_NAME|jq --raw-input --ascii-output '.'` + TAG_NAME=$NEXT_NIGHTLY_TAG + VERSION_PRERELEASE=true + + #Create tag + echo "Creating tag $TAG_NAME..." + echo '{"tag":"'$TAG_NAME'","message":"","object":"'$TAG_COMMIT_HASH'","type":"commit","tagger":{"name":'$ESC_TAGGER_NAME',"email":"'$TAGGER_EMAIL'","date":"'$CURRENT_DATE'"}}'>json.bin + curl --silent --request POST --data-binary @json.bin --header "Content-Type: application/json" --header "Accept: application/vnd.github.manifold-preview" --user $GITHUB_USER:$GITHUB_ACCESS_TOKEN https://api.github.com/repos/$GITHUB_REPO/git/tags>/dev/null + + echo "Tag created" + export DEPLOY_FILEVER_TAG="${VERSION_NUMBER}_nightly${NEXT_NIGHTLY_VER}" + export DEPLOY_RELEASE_TO_REMOVE=$LAST_NIGHTLY_TAG + export DEPLOY_TAG_NAME=$NEXT_NIGHTLY_TAG + export DEPLOY_VERSION_NAME="(PREVIEW) version $LAST_STABLE_VER nightly $NEXT_NIGHTLY_VER" + export DEPLOY_DESCRIPTION=`php ./cicd_scripts/format_release_info.php -filever $DEPLOY_FILEVER_TAG Unreleased $DEPLOY_TAG_NAME ./CHANGELOG.md "$CICD_REPO_SLUG"` + export DEPLOY_COMMITISH=$NIGHTLY_BRANCH + export DEPLOY_PRERELEASE=true + export DO_DEPLOY=1 + else + #tag not set - regular build + echo "Other branch or pull request, regular build..." + ant all + fi + fi +fi + +if [ "$DO_DEPLOY" == 1 ]; then + echo "Deploying..." + GITHUB_REPO=$CICD_REPO_SLUG + + + DEPLOY_ATTACH_FILES_JSON='[ + {"file_name":"ffdec_'$DEPLOY_FILEVER_TAG'_setup.exe","content_type":"application/exe"}, + {"file_name":"ffdec_'$DEPLOY_FILEVER_TAG'.zip","content_type":"application/zip"}, + {"file_name":"ffdec_'$DEPLOY_FILEVER_TAG'.deb","content_type":"application/vnd.debian.binary-package"}, + {"file_name":"ffdec_'$DEPLOY_FILEVER_TAG'.pkg","content_type":"application/x-newton-compatible-pkg"}, + {"file_name":"ffdec_'$DEPLOY_FILEVER_TAG'_macosx.zip","content_type":"application/zip"}, + {"file_name":"ffdec_'$DEPLOY_FILEVER_TAG'_lang.zip","content_type":"application/zip"}, + {"file_name":"ffdec_lib_'$DEPLOY_FILEVER_TAG'.zip","content_type":"application/zip"} + ]'; + + echo "Creating release..." + ESC_VERSION_NAME=`echo $DEPLOY_VERSION_NAME|jq --raw-input --ascii-output '.'` + ESC_VERSION_DESCRIPTION=`printf "$DEPLOY_DESCRIPTION"|jq --raw-input --slurp --ascii-output '.'` + + echo '{"tag_name":"'$DEPLOY_TAG_NAME'","target_commitish":"'$DEPLOY_COMMITISH'","name":'$ESC_VERSION_NAME',"body":'$ESC_VERSION_DESCRIPTION',"draft":false,"prerelease":'$DEPLOY_PRERELEASE'}'>json.bin + json=`curl --silent --request POST --data-binary @json.bin --header "Content-Type: application/json" --header "Accept: application/vnd.github.manifold-preview" --user $GITHUB_USER:$GITHUB_ACCESS_TOKEN https://api.github.com/repos/$GITHUB_REPO/releases` + RELEASE_ID=`echo "$json"|jq '.id'` + + + + #Attaching files... + echo "Attaching files..." + NUM_FILES=`echo "$DEPLOY_ATTACH_FILES_JSON"|jq ".|length"` + + for (( i=0; i<$NUM_FILES; i++ )) + do + ITEM_JSON=`echo "$DEPLOY_ATTACH_FILES_JSON"|jq '.['$i']'` + CONTENT_TYPE=`echo "$ITEM_JSON"|jq --raw-output '.content_type'` + FILE_NAME=`echo "$ITEM_JSON"|jq --raw-output '.file_name'` + FILE_PATH=releases/$FILE_NAME + echo "Attaching $FILE_PATH ..." + if [ ! -f $FILE_PATH ]; then + echo "WARNING: File $FILE_PATH does not exist!" + fi + + curl --silent --request POST --data-binary @$FILE_PATH --header "Content-Type: $CONTENT_TYPE" --header "Accept: application/vnd.github.manifold-preview" --user $GITHUB_USER:$GITHUB_ACCESS_TOKEN https://uploads.github.com/repos/$GITHUB_REPO/releases/$RELEASE_ID/assets?name=$FILE_NAME>/dev/null + done + + if [ -n "$DEPLOY_RELEASE_TO_REMOVE" ]; then + #Remove old nightly + echo "Removing old release $DEPLOY_RELEASE_TO_REMOVE..." + #-remove release + TAG_INFO=`curl --silent --user $GITHUB_USER:$GITHUB_ACCESS_TOKEN https://api.github.com/repos/$GITHUB_REPO/releases/tags/$DEPLOY_RELEASE_TO_REMOVE` + RELEASE_ID=`echo $TAG_INFO|jq '.id'` + curl --silent --request DELETE --user $GITHUB_USER:$GITHUB_ACCESS_TOKEN https://api.github.com/repos/$GITHUB_REPO/releases/$RELEASE_ID>/dev/null + # wait few seconds before DELETE properly propagates so we can delete tag then + sleep 5 + set +e + #delete tag + curl --silent --request DELETE --user $GITHUB_USER:$GITHUB_ACCESS_TOKEN https://api.github.com/repos/$GITHUB_REPO/git/$DEPLOY_RELEASE_TO_REMOVE>/dev/null + fi + echo "FINISHED" + exit 0 +fi diff --git a/travis/tools/launch4j-3.12-linux.tgz b/cicd_scripts/tools/launch4j-3.14-linux-x64.tgz similarity index 50% rename from travis/tools/launch4j-3.12-linux.tgz rename to cicd_scripts/tools/launch4j-3.14-linux-x64.tgz index 516f678a3..898997375 100644 Binary files a/travis/tools/launch4j-3.12-linux.tgz and b/cicd_scripts/tools/launch4j-3.14-linux-x64.tgz differ diff --git a/travis/tools/nsis-3.0-addon.zip b/cicd_scripts/tools/nsis-3.0-addon.zip similarity index 100% rename from travis/tools/nsis-3.0-addon.zip rename to cicd_scripts/tools/nsis-3.0-addon.zip diff --git a/travis/tools/nsis-3.0-src.tar.bz2 b/cicd_scripts/tools/nsis-3.0-src.tar.bz2 similarity index 100% rename from travis/tools/nsis-3.0-src.tar.bz2 rename to cicd_scripts/tools/nsis-3.0-src.tar.bz2 diff --git a/travis/tools/playerglobal32_0.swc b/cicd_scripts/tools/playerglobal32_0.swc similarity index 100% rename from travis/tools/playerglobal32_0.swc rename to cicd_scripts/tools/playerglobal32_0.swc diff --git a/cicd_scripts/tools/readme.txt b/cicd_scripts/tools/readme.txt new file mode 100644 index 000000000..1de0e37bf --- /dev/null +++ b/cicd_scripts/tools/readme.txt @@ -0,0 +1 @@ +These archives are tools needed for successfull CICD build on GitHub. \ No newline at end of file diff --git a/nbproject/project.xml b/nbproject/project.xml index dbfce67c3..427da9d9c 100644 --- a/nbproject/project.xml +++ b/nbproject/project.xml @@ -277,9 +277,6 @@ .gitattributes - - .travis.yml - nbproject/project.xml diff --git a/travis/after_success.sh b/travis/after_success.sh deleted file mode 100644 index b91810925..000000000 --- a/travis/after_success.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env bash -#stop on error -set -e - -if [ "$DO_DEPLOY" = 1 ]; then - echo "Deploying..." - GITHUB_REPO=$TRAVIS_REPO_SLUG - - - DEPLOY_ATTACH_FILES_JSON='[ - {"file_name":"ffdec_'$DEPLOY_FILEVER_TAG'_setup.exe","content_type":"application/exe"}, - {"file_name":"ffdec_'$DEPLOY_FILEVER_TAG'.zip","content_type":"application/zip"}, - {"file_name":"ffdec_'$DEPLOY_FILEVER_TAG'.deb","content_type":"application/vnd.debian.binary-package"}, - {"file_name":"ffdec_'$DEPLOY_FILEVER_TAG'.pkg","content_type":"application/x-newton-compatible-pkg"}, - {"file_name":"ffdec_'$DEPLOY_FILEVER_TAG'_macosx.zip","content_type":"application/zip"}, - {"file_name":"ffdec_'$DEPLOY_FILEVER_TAG'_lang.zip","content_type":"application/zip"}, - {"file_name":"ffdec_lib_'$DEPLOY_FILEVER_TAG'.zip","content_type":"application/zip"} - ]'; - - echo "Creating release..." - ESC_VERSION_NAME=`echo $DEPLOY_VERSION_NAME|jq --raw-input --ascii-output '.'` - ESC_VERSION_DESCRIPTION=`printf "$DEPLOY_DESCRIPTION"|jq --raw-input --slurp --ascii-output '.'` - - echo '{"tag_name":"'$DEPLOY_TAG_NAME'","target_commitish":"'$DEPLOY_COMMITISH'","name":'$ESC_VERSION_NAME',"body":'$ESC_VERSION_DESCRIPTION',"draft":false,"prerelease":'$DEPLOY_PRERELEASE'}'>json.bin - json=`curl --silent --request POST --data-binary @json.bin --header "Content-Type: application/json" --header "Accept: application/vnd.github.manifold-preview" --user $GITHUB_USER:$GITHUB_ACCESS_TOKEN https://api.github.com/repos/$GITHUB_REPO/releases` - RELEASE_ID=`echo "$json"|jq '.id'` - - - - #Attaching files... - echo "Attaching files..." - NUM_FILES=`echo "$DEPLOY_ATTACH_FILES_JSON"|jq ".|length"` - - for (( i=0; i<$NUM_FILES; i++ )) - do - ITEM_JSON=`echo "$DEPLOY_ATTACH_FILES_JSON"|jq '.['$i']'` - CONTENT_TYPE=`echo "$ITEM_JSON"|jq --raw-output '.content_type'` - FILE_NAME=`echo "$ITEM_JSON"|jq --raw-output '.file_name'` - FILE_PATH=releases/$FILE_NAME - echo "Attaching $FILE_PATH ..." - if [ ! -f $FILE_PATH ]; then - echo "WARNING: File $FILE_PATH does not exist!" - fi - - curl --silent --request POST --data-binary @$FILE_PATH --header "Content-Type: $CONTENT_TYPE" --header "Accept: application/vnd.github.manifold-preview" --user $GITHUB_USER:$GITHUB_ACCESS_TOKEN https://uploads.github.com/repos/$GITHUB_REPO/releases/$RELEASE_ID/assets?name=$FILE_NAME>/dev/null - done - - if [ -n "$DEPLOY_RELEASE_TO_REMOVE" ]; then - #Remove old nightly - echo "Removing old release $DEPLOY_RELEASE_TO_REMOVE..." - #-remove release - TAG_INFO=`curl --silent --user $GITHUB_USER:$GITHUB_ACCESS_TOKEN https://api.github.com/repos/$GITHUB_REPO/releases/tags/$DEPLOY_RELEASE_TO_REMOVE` - RELEASE_ID=`echo $TAG_INFO|jq '.id'` - curl --silent --request DELETE --user $GITHUB_USER:$GITHUB_ACCESS_TOKEN https://api.github.com/repos/$GITHUB_REPO/releases/$RELEASE_ID>/dev/null - # wait few seconds before DELETE properly propagates so we can delete tag then - sleep 5 - #-delete tag - git config --local user.email "travis@travis-ci.org" - git config --local user.name "Travis CI" - git remote add myorigin https://${GITHUB_ACCESS_TOKEN}@github.com/$TRAVIS_REPO_SLUG.git - #> /dev/null 2>&1 - set +e - git tag -d $DEPLOY_RELEASE_TO_REMOVE - git push --quiet --delete myorigin $DEPLOY_RELEASE_TO_REMOVE - #> /dev/null 2>&1 - fi - echo "FINISHED" - exit 0 -fi diff --git a/travis/before_install.sh b/travis/before_install.sh deleted file mode 100644 index e8f234dcd..000000000 --- a/travis/before_install.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env bash - -# Exit immediately on first error -set -e -sudo apt-get -qq update -#NSIS needs these -sudo apt-get install -y zlib1g-dev -sudo apt-get install -y lib32ncurses5 lib32z1 -#For deploying -sudo apt-get install -y jq -sudo apt-get install -y curl -#For parsing changelog -#sudo apt-get install -y php7.0-cli -#commented out: assuming travis already has php cli -# test php installed -php --version - -tools_dir=/home/travis/tools - -if [ ! -f "$tools_dir/cached.txt" ]; then - sudo apt-get install -y scons - #For unpacking unzip :-) - sudo apt-get install -y unzip - - # create directory where tools will be downloaded and installed - mkdir -p $tools_dir - - echo "cached">$tools_dir/cached.txt - - cp ./travis/tools/nsis-3.0-src.tar.bz2 ./ - #Unpack NSIS sources - Tool for making windows installers - bzip2 -d nsis-3.0-src.tar.bz2 - tar xvf nsis-3.0-src.tar -C $tools_dir >/dev/null - - #Compile NSIS - cd $tools_dir/nsis-3.0-src/ - scons UNICODE=yes SKIPSTUBS=all SKIPPLUGINS=all SKIPUTILS=all SKIPMISC=all NSIS_CONFIG_CONST_DATA=no PREFIX=$tools_dir/nsis-3.0-src/ install-compiler >/dev/null - mkdir share - #Make this symbolic link, otherwise it does not work - ln -s $tools_dir/nsis-3.0-src share/nsis - cd - - - #Extract some binary additional sources which NSIS needs and are part of Windows ZIP file - cp ./travis/tools/nsis-3.0-addon.zip ./ - unzip -u nsis-3.0-addon.zip -d $tools_dir/nsis-3.0-src - - #Extract launch4j - tool for creating EXE file from Java - cp ./travis/tools/launch4j-3.12-linux.tgz ./ - tar zxvf launch4j-3.12-linux.tgz -C $tools_dir >/dev/null -fi - -#Create tools.properties with paths to NSIS and launch4j -echo "nsis.path = $tools_dir/nsis-3.0-src/bin" > tools.properties -echo "launch4j.path = $tools_dir/launch4j" >> tools.properties - -# Travis secure variable $website_password is not available from outside -# of jpexs repository (e.g pull requests from other users on GitHub) -if ! [ -z ${website_password+x} ]; then - # Store username and password for uploading releases to jpexs server - echo "username=$website_user" > jpexs_website.properties - echo "password=$website_password" >> jpexs_website.properties -fi diff --git a/travis/script.sh b/travis/script.sh deleted file mode 100644 index 0b1ef8a55..000000000 --- a/travis/script.sh +++ /dev/null @@ -1,115 +0,0 @@ -#!/usr/bin/env bash -#stop on error -set -e - -VERSION_PROP_FILE="version.properties" - -# If we've got website password, we can upload nightly builds. -# Travis secure variable $website_password is not available from outside -# of jpexs repository (e.g pull requests from other users on GitHub) - -if [ -z ${GITHUB_ACCESS_TOKEN+x} ]; then - # password not set, just make private release without publishing result - echo "No password set, making private release..." - ant all -else - # if tag set - if [ -n "$TRAVIS_TAG" ]; then - #tag starts with "version" prefix - if [[ $TRAVIS_TAG =~ ^version.* ]] ; then - echo "Version tag, creating new version..." - - #generate prop file - VERSION_NUMBER=`echo $TRAVIS_TAG|sed 's/version//'` - - VERSION_MAJOR=`echo $VERSION_NUMBER|cut -d '.' -f 1` - VERSION_MINOR=`echo $VERSION_NUMBER|cut -d '.' -f 2` - VERSION_RELEASE=`echo $VERSION_NUMBER|cut -d '.' -f 3` - - echo "">$VERSION_PROP_FILE - echo "major=$VERSION_MAJOR">>$VERSION_PROP_FILE - echo "minor=$VERSION_MINOR">>$VERSION_PROP_FILE - echo "release=$VERSION_RELEASE">>$VERSION_PROP_FILE - echo "build=0">>$VERSION_PROP_FILE - echo "revision=$TRAVIS_COMMIT">>$VERSION_PROP_FILE - echo "debug=false">>$VERSION_PROP_FILE - - #compile, build, create files - ant new-version - - # release standard version based on tag - export DEPLOY_TAG_NAME=$TRAVIS_TAG - export DEPLOY_VERSION_NAME="version $VERSION_NUMBER" - export DEPLOY_DESCRIPTION=`php ./travis/format_release_info.php -filever $VERSION_NUMBER $VERSION_NUMBER $DEPLOY_TAG_NAME ./CHANGELOG.md "$TRAVIS_REPO_SLUG"` - export DEPLOY_COMMITISH="master" - export DEPLOY_PRERELEASE=false - export DEPLOY_FILEVER_TAG="$VERSION_NUMBER" - export DO_DEPLOY=1 - else - # regular build - echo "Other tag, regular build..." - ant all - fi - else - #if we are on dev branch and it's not a pull request - if [ $TRAVIS_BRANCH = "dev" ] && [ $TRAVIS_PULL_REQUEST = "false" ]; then - echo "On dev branch and no pull request, creating nightly..." - # create nightly build... - - TAGGER_NAME="Travis CI" - TAGGER_EMAIL=travis@travis-ci.org - - TAG_COMMIT_HASH=$TRAVIS_COMMIT - GITHUB_REPO=$TRAVIS_REPO_SLUG - echo "Getting new version tag and name..." - RELEASES_JSON=`curl --silent --request GET --header "Accept: application/vnd.github.manifold-preview" --user $GITHUB_USER:$GITHUB_ACCESS_TOKEN https://api.github.com/repos/$GITHUB_REPO/releases` - LAST_NIGHTLY_VER=`echo $RELEASES_JSON|jq --raw-output '.[].tag_name'|grep 'nightly'|sed 's/nightly//'|head -n 1` - LAST_STABLE_VER=`echo $RELEASES_JSON|jq --raw-output '.[].tag_name'|grep 'version'|sed 's/version//'|head -n 1` - NEXT_NIGHTLY_VER=$(($LAST_NIGHTLY_VER+1)) - LAST_NIGHTLY_TAG=nightly$LAST_NIGHTLY_VER - NEXT_NIGHTLY_TAG=nightly$NEXT_NIGHTLY_VER - - - #generate prop file - VERSION_NUMBER=$LAST_STABLE_VER - VERSION_MAJOR=`echo $VERSION_NUMBER|cut -d '.' -f 1` - VERSION_MINOR=`echo $VERSION_NUMBER|cut -d '.' -f 2` - VERSION_RELEASE=`echo $VERSION_NUMBER|cut -d '.' -f 3` - - echo "">$VERSION_PROP_FILE - echo "major=$VERSION_MAJOR">>$VERSION_PROP_FILE - echo "minor=$VERSION_MINOR">>$VERSION_PROP_FILE - echo "release=$VERSION_RELEASE">>$VERSION_PROP_FILE - echo "build=$NEXT_NIGHTLY_VER">>$VERSION_PROP_FILE - echo "revision=$TRAVIS_COMMIT">>$VERSION_PROP_FILE - echo "debug=true">>$VERSION_PROP_FILE - - #compile, build, create files - ant new-version - - CURRENT_DATE=`date +%Y-%m-%dT%H:%M:%SZ` - - ESC_TAGGER_NAME=`echo $TAGGER_NAME|jq --raw-input --ascii-output '.'` - TAG_NAME=$NEXT_NIGHTLY_TAG - VERSION_PRERELEASE=true - - #Create tag - echo "Creating tag $TAG_NAME..." - echo '{"tag":"'$TAG_NAME'","message":"","object":"'$TAG_COMMIT_HASH'","type":"commit","tagger":{"name":'$ESC_TAGGER_NAME',"email":"'$TAGGER_EMAIL'","date":"'$CURRENT_DATE'"}}'>json.bin - curl --silent --request POST --data-binary @json.bin --header "Content-Type: application/json" --header "Accept: application/vnd.github.manifold-preview" --user $GITHUB_USER:$GITHUB_ACCESS_TOKEN https://api.github.com/repos/$GITHUB_REPO/git/tags>/dev/null - - export DEPLOY_FILEVER_TAG="${VERSION_NUMBER}_nightly${NEXT_NIGHTLY_VER}" - export DEPLOY_RELEASE_TO_REMOVE=$LAST_NIGHTLY_TAG - export DEPLOY_TAG_NAME=$NEXT_NIGHTLY_TAG - export DEPLOY_VERSION_NAME="(PREVIEW) version $LAST_STABLE_VER nightly $NEXT_NIGHTLY_VER" - export DEPLOY_DESCRIPTION=`php ./travis/format_release_info.php -filever $DEPLOY_FILEVER_TAG Unreleased $DEPLOY_TAG_NAME ./CHANGELOG.md "$TRAVIS_REPO_SLUG"` - export DEPLOY_COMMITISH="dev" - export DEPLOY_PRERELEASE=true - export DO_DEPLOY=1 - else - #tag not set - regular build - echo "Other branch or pull request, regular build..." - ant all - fi - fi -fi diff --git a/travis/tools/readme.txt b/travis/tools/readme.txt deleted file mode 100644 index daf1a7d3b..000000000 --- a/travis/tools/readme.txt +++ /dev/null @@ -1 +0,0 @@ -These archives are tools needed for successfull Travis build on GitHub. \ No newline at end of file