mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-05-22 01:17:03 +00:00
Building using Github actions (#131)
Change Travis CICD to GitHub Actions
This commit is contained in:
58
.github/workflows/main.yml
vendored
Normal file
58
.github/workflows/main.yml
vendored
Normal file
@@ -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
|
||||
27
.travis.yml
27
.travis.yml
@@ -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).*/
|
||||
@@ -93,4 +93,4 @@ dist.lib.dirname = lib
|
||||
javadoc.dir = javadoc
|
||||
|
||||
ant.lib.dir = antlib
|
||||
adobe.playerglobal.path = travis/tools/playerglobal32_0.swc
|
||||
adobe.playerglobal.path = cicd_scripts/tools/playerglobal32_0.swc
|
||||
17
build.xml
17
build.xml
@@ -175,7 +175,7 @@
|
||||
|
||||
<target name="installer" depends="-loadversion,-load-tools,dist">
|
||||
<property name="exe.file" value="${releases.dir}/${prefix.filename}_${version}${version.suffix}_setup.exe"/>
|
||||
<nsis script="installer.nsi" path="${nsis.path}" verbosity="2">
|
||||
<!--<nsis script="installer.nsi" path="${nsis.path}" verbosity="2">
|
||||
<define name="APP_NAME" value="${product.name}"/>
|
||||
<define name="APP_VER" value="${version}${version.suffix}"/>
|
||||
<define name="APP_VER_MAJOR" value="${version.major}"/>
|
||||
@@ -185,6 +185,19 @@
|
||||
<define name="APP_SETUPFILE" value="${exe.file}" />
|
||||
<define name="JRE_VERSION" value="${target.java}" />
|
||||
</nsis>
|
||||
-->
|
||||
<exec executable="${nsis.path}/makensis">
|
||||
<arg value="-V2" />
|
||||
<arg value="-DAPP_NAME=${product.name}" />
|
||||
<arg value="-DAPP_VER=${version}${version.suffix}" />
|
||||
<arg value="-DAPP_VER_MAJOR=${version.major}" />
|
||||
<arg value="-DAPP_VER_MINOR=${version.minor}" />
|
||||
<arg value="-DAPP_PUBLISHER=${vendor}" />
|
||||
<arg value="-DAPP_URL=${product.url}" />
|
||||
<arg value="-DAPP_SETUPFILE=${exe.file}" />
|
||||
<arg value="-DJRE_VERSION=${target.java}" />
|
||||
<arg value="/__w/jpexs-decompiler/jpexs-decompiler/installer.nsi" />
|
||||
</exec>
|
||||
<echo level="info" message="Setup created in ${exe.file}"/>
|
||||
</target>
|
||||
|
||||
@@ -598,7 +611,7 @@
|
||||
</target>
|
||||
|
||||
<target name="-git-required" depends="-git-check-exists" unless="private">
|
||||
<fail unless="git.present" message="Git not found. Please install git with commandline support."/>
|
||||
<!-- <fail unless="git.present" message="Git not found. Please install git with commandline support."/> -->
|
||||
</target>
|
||||
|
||||
<target name="-do-git-tag" if="git.present">
|
||||
|
||||
38
cicd_scripts/before_install.sh
Normal file
38
cicd_scripts/before_install.sh
Normal file
@@ -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
|
||||
176
cicd_scripts/script.sh
Normal file
176
cicd_scripts/script.sh
Normal file
@@ -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
|
||||
Binary file not shown.
1
cicd_scripts/tools/readme.txt
Normal file
1
cicd_scripts/tools/readme.txt
Normal file
@@ -0,0 +1 @@
|
||||
These archives are tools needed for successfull CICD build on GitHub.
|
||||
@@ -277,9 +277,6 @@
|
||||
<source-file>
|
||||
<location>.gitattributes</location>
|
||||
</source-file>
|
||||
<source-file>
|
||||
<location>.travis.yml</location>
|
||||
</source-file>
|
||||
<source-file>
|
||||
<location>nbproject/project.xml</location>
|
||||
</source-file>
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
115
travis/script.sh
115
travis/script.sh
@@ -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
|
||||
@@ -1 +0,0 @@
|
||||
These archives are tools needed for successfull Travis build on GitHub.
|
||||
Reference in New Issue
Block a user