Save screenshots for master and dev, in separate branches

This commit is contained in:
Georges Dupéron 2018-07-03 21:34:34 +02:00
parent 74ce426c80
commit 118be99a3a
3 changed files with 14 additions and 11 deletions

View File

@ -89,7 +89,8 @@ script:
- | - |
./utils/auto-push.sh "https://github.com/jsmaniac/travis-os.git" \ ./utils/auto-push.sh "https://github.com/jsmaniac/travis-os.git" \
"git@github.com:jsmaniac/travis-os-deploy-artifacts.git" \ "git@github.com:jsmaniac/travis-os-deploy-artifacts.git" \
"screenshots-$MODE" \ "screenshots-$TRAVIS_BRANCH-$MODE" \
"deploy-base" \ "deploy-base" \
"edf345aad47e" \ "edf345aad47e" \
"deploy-screenshots" "deploy-screenshots" \
"$(if test "$TRAVIS_BRANCH" = "master"; then echo master; else echo dev; fi)"

View File

@ -6,20 +6,20 @@ Below are screenshots of an example operating system. This example merely displa
## QEMU ## 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 ## 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 ## 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) ## 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) ## 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)

View File

@ -10,12 +10,13 @@ usage() {
echo "deploy_base_commit: branch name or tag" echo "deploy_base_commit: branch name or tag"
echo "key_iv_id: 123456789abc, part of encrypted_123456789abc_key and encrypted_123456789abc_iv" 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 "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 if test "$#" -eq 1 && test "$1" = "-h" -o "$1" = "--help"; then
usage usage
exit 0 exit 0
elif test "$#" -ne 6; then elif test "$#" -ne 7; then
usage usage
exit 1 exit 1
fi fi
@ -26,6 +27,7 @@ deploy_branch="$3" # gh-pages
deploy_base_commit="$4" # branch name or tag deploy_base_commit="$4" # branch name or tag
key_iv_id="$5" # 123456789abc, part of encrypted_123456789abc_key and encrypted_123456789abc_iv 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 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" key_env_var_name="encrypted_${key_iv_id}_key"
iv_env_var_name="encrypted_${key_iv_id}_iv" iv_env_var_name="encrypted_${key_iv_id}_iv"
key="$(sh -c 'echo "${'"$key_env_var_name"'}"')" 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}." echo "Not on official repo, will not deploy to ${deploy_repo}:${deploy_branch}."
elif test "$TRAVIS_PULL_REQUEST" != "false"; then elif test "$TRAVIS_PULL_REQUEST" != "false"; then
echo "This is a Pull Request, will not deploy to ${deploy_repo}:${deploy_branch}." echo "This is a Pull Request, will not deploy to ${deploy_repo}:${deploy_branch}."
elif test "$TRAVIS_BRANCH" != "master"; then elif test "$TRAVIS_BRANCH" != "$from_branch"; then
echo "Not on master branch (TRAVIS_BRANCH = $TRAVIS_BRANCH), will not deploy to ${deploy_repo}:${deploy_branch}." 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 elif test -z "${key:-}" -o -z "${iv:-}"; then
echo "Travis CI secure environment variables are unavailable, will not deploy to ${deploy_repo}:${deploy_branch}." 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 elif test ! -e travis-deploy-key-id_rsa.enc; then
@ -69,6 +71,6 @@ else
rsync -a "${deploy_directory}/" "${TRAVIS_AUTO_PUSH_REPO_DIR}/" 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 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) (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. (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 fi