From e5e539f40f4dc695b84e04341ca59435571d8257 Mon Sep 17 00:00:00 2001 From: tritoch Date: Wed, 7 Jun 2017 15:23:30 -0500 Subject: [PATCH 01/11] Testing Travis --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5e37e17b..6f394e2e 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ pip install -r requirements.txt ``` ### Usage ### - + ``` $> python main.py ``` From 80f11db6a83dad48ad63f033d9979e14efd86d38 Mon Sep 17 00:00:00 2001 From: tritoch Date: Mon, 12 Jun 2017 08:38:37 -0500 Subject: [PATCH 02/11] Travis build push, not pull --- deploy.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/deploy.sh b/deploy.sh index a5e8af97..32ea5431 100644 --- a/deploy.sh +++ b/deploy.sh @@ -31,7 +31,12 @@ cd .. rm -rf out/**/* || exit 0 # Run our compile script -doCompile +# doCompile + +# Build pushes, not pulls. +if [ "${ghToken:-false}" != "false" ]; then + doCompile +fi # Now let's go have some fun with the cloned repo cd out From eefe47d7be11e46046ae72068da31861828bfce6 Mon Sep 17 00:00:00 2001 From: tritoch Date: Mon, 12 Jun 2017 09:04:35 -0500 Subject: [PATCH 03/11] Testing Travis Testing to see if Travis builds a PR --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6f394e2e..5e71a2fb 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ pip install -r requirements.txt ``` ### Usage ### - + ``` $> python main.py ``` From 7bbc7bc40276b91f8fa349e50d1dcdfc6b54bcf5 Mon Sep 17 00:00:00 2001 From: tritoch Date: Tue, 13 Jun 2017 11:13:20 -0500 Subject: [PATCH 04/11] Run the script for PR, just don't push it to files --- deploy.sh | 68 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 35 insertions(+), 33 deletions(-) diff --git a/deploy.sh b/deploy.sh index 32ea5431..c5b4b504 100644 --- a/deploy.sh +++ b/deploy.sh @@ -8,6 +8,38 @@ function doCompile { python main.py } +function pushRepo { + # Now let's go have some fun with the cloned repo + cd out + ls + git config user.name "Travis CI" + git config user.email "$COMMIT_AUTHOR_EMAIL" + + # If there are no changes to the compiled out (e.g. this is a README update) then just bail. + #if git diff --quiet; then + # echo "No changes to the output on this push; exiting." + # exit 0 + #fi + + # Commit the "changes", i.e. the new version. + # The delta will show diffs between new and old versions. + git add -A . + git commit --allow-empty -m "Deploy to GitHub: ${SHA}" + + # Get the deploy key by using Travis's stored variables to decrypt deploy_key.enc + ENCRYPTED_KEY_VAR="encrypted_${ENCRYPTION_LABEL}_key" + ENCRYPTED_IV_VAR="encrypted_${ENCRYPTION_LABEL}_iv" + ENCRYPTED_KEY=${!ENCRYPTED_KEY_VAR} + ENCRYPTED_IV=${!ENCRYPTED_IV_VAR} + openssl aes-256-cbc -K $ENCRYPTED_KEY -iv $ENCRYPTED_IV -in ../deploy_key.enc -out ../deploy_key -d + chmod 600 ../deploy_key + eval `ssh-agent -s` + ssh-add ../deploy_key + + # Now that we're all set up, we can push. + git push $SSH_REPO $TARGET_BRANCH +} + # Pull requests and commits to other branches shouldn't try to deploy, just build to verify #if [ "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_BRANCH" != "$SOURCE_BRANCH" ]; then # echo "Skipping deploy; just doing a build." @@ -31,39 +63,9 @@ cd .. rm -rf out/**/* || exit 0 # Run our compile script -# doCompile +doCompile -# Build pushes, not pulls. +# Push merge or push to our files repo, not pulls. if [ "${ghToken:-false}" != "false" ]; then - doCompile + pushRepo fi - -# Now let's go have some fun with the cloned repo -cd out -ls -git config user.name "Travis CI" -git config user.email "$COMMIT_AUTHOR_EMAIL" - -# If there are no changes to the compiled out (e.g. this is a README update) then just bail. -#if git diff --quiet; then -# echo "No changes to the output on this push; exiting." -# exit 0 -#fi - -# Commit the "changes", i.e. the new version. -# The delta will show diffs between new and old versions. -git add -A . -git commit --allow-empty -m "Deploy to GitHub: ${SHA}" - -# Get the deploy key by using Travis's stored variables to decrypt deploy_key.enc -ENCRYPTED_KEY_VAR="encrypted_${ENCRYPTION_LABEL}_key" -ENCRYPTED_IV_VAR="encrypted_${ENCRYPTION_LABEL}_iv" -ENCRYPTED_KEY=${!ENCRYPTED_KEY_VAR} -ENCRYPTED_IV=${!ENCRYPTED_IV_VAR} -openssl aes-256-cbc -K $ENCRYPTED_KEY -iv $ENCRYPTED_IV -in ../deploy_key.enc -out ../deploy_key -d -chmod 600 ../deploy_key -eval `ssh-agent -s` -ssh-add ../deploy_key - -# Now that we're all set up, we can push. -git push $SSH_REPO $TARGET_BRANCH From b00b8bc154929da0275dd9560a511eb4750ceeff Mon Sep 17 00:00:00 2001 From: tritoch Date: Tue, 13 Jun 2017 11:32:09 -0500 Subject: [PATCH 05/11] Move branch write inside calling function --- deploy.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/deploy.sh b/deploy.sh index c5b4b504..34ba5fa0 100644 --- a/deploy.sh +++ b/deploy.sh @@ -6,9 +6,13 @@ TARGET_BRANCH="files" function doCompile { python main.py + # Push merge or push to our files repo, not pulls. + if [ "${ghToken:-false}" != "false" ]; then + pushBranch + fi } -function pushRepo { +function pushBranch { # Now let's go have some fun with the cloned repo cd out ls @@ -64,8 +68,3 @@ rm -rf out/**/* || exit 0 # Run our compile script doCompile - -# Push merge or push to our files repo, not pulls. -if [ "${ghToken:-false}" != "false" ]; then - pushRepo -fi From 1aa29e4a4fbea00fae0b3e6e9486a1086e3659d7 Mon Sep 17 00:00:00 2001 From: tritoch Date: Tue, 13 Jun 2017 11:43:31 -0500 Subject: [PATCH 06/11] Debug PR vs Push Travis --- deploy.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/deploy.sh b/deploy.sh index 34ba5fa0..f3a7ea71 100644 --- a/deploy.sh +++ b/deploy.sh @@ -6,10 +6,6 @@ TARGET_BRANCH="files" function doCompile { python main.py - # Push merge or push to our files repo, not pulls. - if [ "${ghToken:-false}" != "false" ]; then - pushBranch - fi } function pushBranch { @@ -67,4 +63,14 @@ cd .. rm -rf out/**/* || exit 0 # Run our compile script -doCompile +#doCompile + +# Push merge or push to our files repo, not pulls. +if [ "${ghToken:-false}" != "false" ]; then + echo This is a Push + doCompile + pushBranch +else + echo This is a PR + doCompile +fi From 77ca65c927702c146159b0f5b48ac42ce28709df Mon Sep 17 00:00:00 2001 From: tritoch Date: Tue, 13 Jun 2017 11:57:15 -0500 Subject: [PATCH 07/11] Travis Debug --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5e71a2fb..f5a9dec4 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ pip install -r requirements.txt ``` ### Usage ### - + ``` $> python main.py ``` From 743a89070fc18d05a9ef3745e6f779cec2cc2ed1 Mon Sep 17 00:00:00 2001 From: tritoch Date: Tue, 13 Jun 2017 12:10:27 -0500 Subject: [PATCH 08/11] Travis Debug --- deploy.sh | 75 +++++++++++++++++++++++++------------------------------ 1 file changed, 34 insertions(+), 41 deletions(-) diff --git a/deploy.sh b/deploy.sh index f3a7ea71..ce7818a5 100644 --- a/deploy.sh +++ b/deploy.sh @@ -8,38 +8,6 @@ function doCompile { python main.py } -function pushBranch { - # Now let's go have some fun with the cloned repo - cd out - ls - git config user.name "Travis CI" - git config user.email "$COMMIT_AUTHOR_EMAIL" - - # If there are no changes to the compiled out (e.g. this is a README update) then just bail. - #if git diff --quiet; then - # echo "No changes to the output on this push; exiting." - # exit 0 - #fi - - # Commit the "changes", i.e. the new version. - # The delta will show diffs between new and old versions. - git add -A . - git commit --allow-empty -m "Deploy to GitHub: ${SHA}" - - # Get the deploy key by using Travis's stored variables to decrypt deploy_key.enc - ENCRYPTED_KEY_VAR="encrypted_${ENCRYPTION_LABEL}_key" - ENCRYPTED_IV_VAR="encrypted_${ENCRYPTION_LABEL}_iv" - ENCRYPTED_KEY=${!ENCRYPTED_KEY_VAR} - ENCRYPTED_IV=${!ENCRYPTED_IV_VAR} - openssl aes-256-cbc -K $ENCRYPTED_KEY -iv $ENCRYPTED_IV -in ../deploy_key.enc -out ../deploy_key -d - chmod 600 ../deploy_key - eval `ssh-agent -s` - ssh-add ../deploy_key - - # Now that we're all set up, we can push. - git push $SSH_REPO $TARGET_BRANCH -} - # Pull requests and commits to other branches shouldn't try to deploy, just build to verify #if [ "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_BRANCH" != "$SOURCE_BRANCH" ]; then # echo "Skipping deploy; just doing a build." @@ -63,14 +31,39 @@ cd .. rm -rf out/**/* || exit 0 # Run our compile script -#doCompile +doCompile -# Push merge or push to our files repo, not pulls. -if [ "${ghToken:-false}" != "false" ]; then - echo This is a Push - doCompile - pushBranch -else - echo This is a PR - doCompile +# Don't push to our branch for PRs. +if [ "${ghToken:-false}" == "false" ]; then + exit 0 fi + +# Now let's go have some fun with the cloned repo +cd out +ls +git config user.name "Travis CI" +git config user.email "$COMMIT_AUTHOR_EMAIL" + +# If there are no changes to the compiled out (e.g. this is a README update) then just bail. +#if git diff --quiet; then +# echo "No changes to the output on this push; exiting." +# exit 0 +#fi + +# Commit the "changes", i.e. the new version. +# The delta will show diffs between new and old versions. +git add -A . +git commit --allow-empty -m "Deploy to GitHub: ${SHA}" + +# Get the deploy key by using Travis's stored variables to decrypt deploy_key.enc +ENCRYPTED_KEY_VAR="encrypted_${ENCRYPTION_LABEL}_key" +ENCRYPTED_IV_VAR="encrypted_${ENCRYPTION_LABEL}_iv" +ENCRYPTED_KEY=${!ENCRYPTED_KEY_VAR} +ENCRYPTED_IV=${!ENCRYPTED_IV_VAR} +openssl aes-256-cbc -K $ENCRYPTED_KEY -iv $ENCRYPTED_IV -in ../deploy_key.enc -out ../deploy_key -d +chmod 600 ../deploy_key +eval `ssh-agent -s` +ssh-add ../deploy_key + +# Now that we're all set up, we can push. +git push $SSH_REPO $TARGET_BRANCH From d36e42e35f0b897f82a1238c7b77b7b73170f711 Mon Sep 17 00:00:00 2001 From: tritoch Date: Tue, 13 Jun 2017 12:22:24 -0500 Subject: [PATCH 09/11] Travis Debug --- deploy.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/deploy.sh b/deploy.sh index ce7818a5..f9613d1d 100644 --- a/deploy.sh +++ b/deploy.sh @@ -31,11 +31,11 @@ cd .. rm -rf out/**/* || exit 0 # Run our compile script -doCompile +#doCompile # Don't push to our branch for PRs. -if [ "${ghToken:-false}" == "false" ]; then - exit 0 +if [ "${ghToken:-false}" != "false" ]; then + doCompile fi # Now let's go have some fun with the cloned repo From 38b27182a96560f8e790c27d68c8548370420342 Mon Sep 17 00:00:00 2001 From: tritoch Date: Tue, 13 Jun 2017 12:29:20 -0500 Subject: [PATCH 10/11] Create deploy.sh --- deploy.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/deploy.sh b/deploy.sh index f9613d1d..28c26ba0 100644 --- a/deploy.sh +++ b/deploy.sh @@ -36,6 +36,9 @@ rm -rf out/**/* || exit 0 # Don't push to our branch for PRs. if [ "${ghToken:-false}" != "false" ]; then doCompile +else + doCompile + exit 0 fi # Now let's go have some fun with the cloned repo From cb8722fdb4e92bf772a9ca1074755d5bbeb22665 Mon Sep 17 00:00:00 2001 From: tritoch Date: Tue, 13 Jun 2017 15:11:05 -0500 Subject: [PATCH 11/11] More Travis Debug --- deploy.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/deploy.sh b/deploy.sh index 28c26ba0..102e48d5 100644 --- a/deploy.sh +++ b/deploy.sh @@ -33,6 +33,10 @@ rm -rf out/**/* || exit 0 # Run our compile script #doCompile +echo TRAVIS_PULL_REQUEST ${TRAVIS_PULL_REQUEST} +echo TRAVIS_SECURE_ENV_VARS ${TRAVIS_SECURE_ENV_VARS} +echo TRAVIS_EVENT_TYPE ${TRAVIS_EVENT_TYPE} + # Don't push to our branch for PRs. if [ "${ghToken:-false}" != "false" ]; then doCompile