Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Removing branch argument from deploy tasks. #42

Merged
merged 1 commit into from
May 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ script:
- ../bolted8/bolt.sh build:validate:test -Dbehat.run-server=true -Dbehat.launch-phantom=true
# Deploy build artifact.
- export DEPLOY_PR=true
- ../bolted8/scripts/deploy/travis-deploy.sh 8.x 8.x-build
- ../bolted8/scripts/deploy/travis-deploy.sh 8.x
# Validate and run 'bolt' phpunit tests.
- phpcs --standard=../bolted8/vendor/drupal/coder/coder_sniffer/Drupal/ruleset.xml tests
- phpunit tests
4 changes: 2 additions & 2 deletions template/.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ script:

after_success:
# Watch for successful build job on `master` branch; deploy to `master-build`.
# - scripts/deploy/travis-deploy.sh master master-build
# - scripts/deploy/travis-deploy.sh master
# Watch for successful build job on `develop` branch; deploy to `develop-build`.
# - scripts/deploy/travis-deploy.sh develop develop-build
# - scripts/deploy/travis-deploy.sh develop
11 changes: 6 additions & 5 deletions template/build/core/phing/tasks/deploy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@

<target name="deploy:artifact" description="Builds separate artifact and pushes to git.remotes defined project.yml.">

<!-- deploy.branch and deploy.commitMsg must be passed as params at runtime. -->
<!-- deploy.commitMsg must be passed as a param at runtime. -->
<if>
<or>
<not><isset property="deploy.branch"/></not>
<not><isset property="deploy.commitMsg"/></not>
</or>
<then>
<fail>You must pass deploy.branch and deploy.commitMsg as runtime parameters.</fail>
<fail>You must pass deploy.commitMsg as a runtime parameter.</fail>
<echo message="Command should match syntax:"/>
<echo message="./bolt.sh deploy:artifact -Ddeploy.branch=8.x-build -Ddeploy.commitMsg='BLT-123: The commit message.'"/>
<echo message="./bolt.sh deploy:artifact -Ddeploy.commitMsg='BLT-123: The commit message.'"/>
</then>
</if>

Expand Down Expand Up @@ -39,8 +38,10 @@
<exec command="git remote add ${remoteName} ${deploy.remote}" dir="${deploy.dir}" logoutput="true" passthru="true"/>
<exec command="git fetch ${remoteName}" dir="${deploy.dir}" logoutput="true" passthru="true"/>

<!-- Create the new branch. -->
<!-- Create the new branch, "[source-branch-name]-build". -->
<property name="deploy.branch" value="${git.current_branch}-build" />
<exec command="git checkout -b ${deploy.branch}" dir="${deploy.dir}" logoutput="true" passthru="true"/>

<!-- Pull the latest updates (if available). -->
<exec command="git merge ${remoteName}/${deploy.branch}" dir="${deploy.dir}" logoutput="true" passthru="true"/>
</target>
Expand Down
5 changes: 2 additions & 3 deletions template/scripts/deploy/travis-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
# What does this script do?
# This script will watch for a Travis build on a specific
# $source_branch on the canonical GitHub repository and deploy build artifacts
# to $dest_branch on the git.remote specified in project.yml.
# to [source-branch]-build on the git.remote specified in project.yml.

# How to use this script?
# This script should be executed in the `after_success` section of .travis.yml.
# It requires two arguments. Example call:
# `scripts/deploy/travis-deploy.sh master master-build`

source_branch=$1 # The branch to watch.
dest_branch=$2 # The branch to which the build artifact should be committed and deployed.
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )

# Note that the canonical repository is watched. Commits to forked repositories
Expand All @@ -27,7 +26,7 @@ if [[ "${TRAVIS_PULL_REQUEST}" = "false" ]] || [[ "${DEPLOY_PR}" = "true" ]];
echo "Build artifact will be deployed."
commit_msg="Automated commit by Travis CI for Build #${TRAVIS_BUILD_ID}";
# Call the `deploy` Phing target, passing in required parameters.
${DIR}/../../bolt.sh deploy:artifact -Ddeploy.branch="${dest_branch}" -Ddeploy.commitMsg="${commit_msg}";
${DIR}/../../bolt.sh deploy:artifact -Ddeploy.commitMsg="${commit_msg}";
else
echo "Build artifact will NOT be deployed for this branch."
fi
Expand Down