diff --git a/.travis.yml b/.travis.yml index 89746c5..1300266 100644 --- a/.travis.yml +++ b/.travis.yml @@ -89,7 +89,8 @@ script: - | ./utils/auto-push.sh "https://github.com/jsmaniac/travis-os.git" \ "git@github.com:jsmaniac/travis-os-deploy-artifacts.git" \ - "screenshots-$MODE" \ + "screenshots-$TRAVIS_BRANCH-$MODE" \ "deploy-base" \ "edf345aad47e" \ - "deploy-screenshots" + "deploy-screenshots" \ + "$(if test "$TRAVIS_BRANCH" = "master"; then echo master; else echo dev; fi)" diff --git a/README.md b/README.md index b477ee4..f20e05b 100644 --- a/README.md +++ b/README.md @@ -6,20 +6,20 @@ Below are screenshots of an example operating system. This example merely displa ## QEMU -![Latest screenshot of the operating system running in QEMU](https://raw.githubusercontent.com/jsmaniac/travis-os-deploy-artifacts/screenshots-qemu-system-i386/qemu-system-i386.png) +![Latest screenshot of the operating system running in QEMU](https://raw.githubusercontent.com/jsmaniac/travis-os-deploy-artifacts/screenshots-master-qemu-system-i386/qemu-system-i386.png) ## VirtualBox -![Latest screenshot of the operating system running in VirtualBox](https://raw.githubusercontent.com/jsmaniac/travis-os-deploy-artifacts/screenshots-virtualbox/virtualbox.png) +![Latest screenshot of the operating system running in VirtualBox](https://raw.githubusercontent.com/jsmaniac/travis-os-deploy-artifacts/screenshots-master-virtualbox/virtualbox.png) ## Bochs -![Latest screenshot of the operating system running in Bochs](https://raw.githubusercontent.com/jsmaniac/travis-os-deploy-artifacts/screenshots-bochs/bochs.png) +![Latest screenshot of the operating system running in Bochs](https://raw.githubusercontent.com/jsmaniac/travis-os-deploy-artifacts/screenshots-master-bochs/bochs.png) ## DOSBox (.bat) -![Latest screenshot of the operating system running in dosbox](https://raw.githubusercontent.com/jsmaniac/travis-os-deploy-artifacts/screenshots-dosbox/dosbox.png) +![Latest screenshot of the operating system running in dosbox](https://raw.githubusercontent.com/jsmaniac/travis-os-deploy-artifacts/screenshots-master-dosbox/dosbox.png) ## Unix graphical environment (.sh) -![Latest screenshot of the operating system running in gui-sh](https://raw.githubusercontent.com/jsmaniac/travis-os-deploy-artifacts/screenshots-gui-sh/gui-sh.png) +![Latest screenshot of the operating system running in gui-sh](https://raw.githubusercontent.com/jsmaniac/travis-os-deploy-artifacts/screenshots-master-gui-sh/gui-sh.png) diff --git a/utils/auto-push.sh b/utils/auto-push.sh index 93336f1..da96246 100755 --- a/utils/auto-push.sh +++ b/utils/auto-push.sh @@ -10,12 +10,13 @@ usage() { echo "deploy_base_commit: branch name or tag" echo "key_iv_id: 123456789abc, part of encrypted_123456789abc_key and encrypted_123456789abc_iv" echo "deploy_directory: directory to copy on top of deploy_base_commit" + echo "from_branch: master # allow push only when building the given branch" } if test "$#" -eq 1 && test "$1" = "-h" -o "$1" = "--help"; then usage exit 0 -elif test "$#" -ne 6; then +elif test "$#" -ne 7; then usage exit 1 fi @@ -26,6 +27,7 @@ deploy_branch="$3" # gh-pages deploy_base_commit="$4" # branch name or tag key_iv_id="$5" # 123456789abc, part of encrypted_123456789abc_key and encrypted_123456789abc_iv deploy_directory="$6" # directory to copy on top of deploy_base_commit +from_branch="$7" # master # allow push only when building the given branch key_env_var_name="encrypted_${key_iv_id}_key" iv_env_var_name="encrypted_${key_iv_id}_iv" key="$(sh -c 'echo "${'"$key_env_var_name"'}"')" @@ -35,8 +37,8 @@ if test "$(git config remote.origin.url)" != "$official_repo"; then echo "Not on official repo, will not deploy to ${deploy_repo}:${deploy_branch}." elif test "$TRAVIS_PULL_REQUEST" != "false"; then echo "This is a Pull Request, will not deploy to ${deploy_repo}:${deploy_branch}." -elif test "$TRAVIS_BRANCH" != "master"; then - echo "Not on master branch (TRAVIS_BRANCH = $TRAVIS_BRANCH), will not deploy to ${deploy_repo}:${deploy_branch}." +elif test "$TRAVIS_BRANCH" != "$from_branch"; then + echo "Not on $from_branch branch (TRAVIS_BRANCH = $TRAVIS_BRANCH), will not deploy to ${deploy_repo}:${deploy_branch}." elif test -z "${key:-}" -o -z "${iv:-}"; then echo "Travis CI secure environment variables are unavailable, will not deploy to ${deploy_repo}:${deploy_branch}." elif test ! -e travis-deploy-key-id_rsa.enc; then @@ -69,6 +71,6 @@ else rsync -a "${deploy_directory}/" "${TRAVIS_AUTO_PUSH_REPO_DIR}/" (cd "$TRAVIS_AUTO_PUSH_REPO_DIR" && git add -A . && git commit --allow-empty -m "Auto-publish to $deploy_branch") > commit.log || (cat commit.log && exit 1) (cd "$TRAVIS_AUTO_PUSH_REPO_DIR" && git log --oneline --decorate --graph -10) - echo '(cd '"$TRAVIS_AUTO_PUSH_REPO_DIR"' && git push --force --quiet "'"$deploy_repo"'" "master:'"$deploy_branch"'")' + echo '(cd '"$TRAVIS_AUTO_PUSH_REPO_DIR"' && git push --force --quiet "'"$deploy_repo"'" "'"$deploy_branch"'")' (cd "$TRAVIS_AUTO_PUSH_REPO_DIR" && git push --force --quiet "$deploy_repo" "$deploy_branch" >/dev/null 2>&1) >/dev/null 2>&1 # redirect to /dev/null to avoid showing credentials. fi