diff --git a/.travis.yml b/.travis.yml index 3dd4b06..5a8560c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,21 +2,27 @@ dist: trusty sudo: required language: bash +branches: + only: + - master + stages: - - Build - - Release + - name: Build and Release jobs: include: - - stage: Build - name: "Build zip distribution" - script: + - stage: "Build and Release" + name: "Build and release alfresco-keycloak-theme" + if: fork = false AND (branch = master) AND type != pull_request AND commit_message !~ /\[no-release\]/ + before_deploy: + - ./set-version.sh + - source build.properties + - echo "Prepare deployment of alfresco-keycloak-theme-$THEME_VERSION" - ./build.sh - - stage: Release deploy: provider: releases api_key: $GITHUB_TOKEN - file: "alfresco-keycloak-theme-$TRAVIS_TAG.zip" + file: "alfresco-keycloak-theme-$THEME_VERSION.zip" skip_cleanup: true edge: true on: diff --git a/build.properties b/build.properties old mode 100644 new mode 100755 index c51ad26..f64235b --- a/build.properties +++ b/build.properties @@ -1 +1 @@ -THEME_VERSION=0.2 +THEME_VERSION=0.1 diff --git a/release.sh b/release.sh deleted file mode 100755 index d10d11b..0000000 --- a/release.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -e - -set -o errexit - -declare -r currentDir="$(dirname "${BASH_SOURCE[0]}")" -source "${currentDir}/build.properties" - -CURRENT_BRANCH=$(git branch | grep '*' | cut -d' ' -f 2) - -echo "Do you wish to tag and push the current branch '$CURRENT_BRANCH' as '$THEME_VERSION' ?" -select yn in "Yes" "No"; do - case $yn in - Yes) - git tag "$THEME_VERSION" -m "" - git push origin "$THEME_VERSION" - break - ;; - No) - exit - ;; - esac -done \ No newline at end of file diff --git a/set-version.sh b/set-version.sh new file mode 100755 index 0000000..7d8065e --- /dev/null +++ b/set-version.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +OLD_VERSION=$(cat build.properties | grep THEME_VERSION) +OLD_VALUE=$(echo $OLD_VERSION | cut -f 2 -d "=") + +NEW_VALUE=$(echo $OLD_VALUE + .1 | bc) + +if [[ $NEW_VALUE == .* ]]; then + # Append zero + NEW_VALUE="0$NEW_VALUE" +fi + +echo "Setting the THEME_VERSION from '$OLD_VALUE' to '$NEW_VALUE'" + +NEW_VERSION=$(echo THEME_VERSION=$NEW_VALUE) +sed -i -e "s/$OLD_VERSION/$NEW_VERSION/" build.properties