add auto-update script
This commit is contained in:
parent
351bfefbc3
commit
2210822b27
3 changed files with 38 additions and 5 deletions
12
.travis.yml
12
.travis.yml
|
|
@ -1,7 +1,9 @@
|
|||
sudo: required
|
||||
os:
|
||||
- osx
|
||||
- linux
|
||||
language: nix
|
||||
before_install:
|
||||
- openssl aes-256-cbc -K $encrypted_025d6e877aa4_key -iv $encrypted_025d6e877aa4_iv -in ci/deploy_key.enc -out deploy_key -d
|
||||
- chmod 600 deploy_key
|
||||
- eval "$(ssh-agent -s)"
|
||||
- ssh-add deploy_key
|
||||
- rm deploy_key
|
||||
script:
|
||||
- nix-build
|
||||
- bash ci/deploy.sh
|
||||
|
|
|
|||
31
ci/deploy.sh
Executable file
31
ci/deploy.sh
Executable file
|
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -eux -o pipefail # Exit with nonzero exit code if anything fails
|
||||
|
||||
# Pull requests and commits to other branches shouldn't try to deploy, just build to verify
|
||||
if [[ "$TRAVIS_PULL_REQUEST" != "false" ]] || \
|
||||
[[ "$TRAVIS_BRANCH" != master ]] && \
|
||||
[[ "$TRAVIS_BRANCH" != "$(cat .version)" ]]; then
|
||||
echo "Skipping deploy; just doing a build."
|
||||
python ./bin/update.py
|
||||
nix-build
|
||||
exit 0
|
||||
fi
|
||||
|
||||
python ./bin/update.py
|
||||
nix-build
|
||||
|
||||
if [ "$TRAVIS_BRANCH" = master ]; then
|
||||
git config user.name "Travis CI"
|
||||
git config user.email "$COMMIT_AUTHOR_EMAIL"
|
||||
|
||||
if [ -z "$(git diff --exit-code)" ]; then
|
||||
echo "No changes to the output on this push; exiting."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
git add --all repos.json*
|
||||
|
||||
git commit -m "automatic update"
|
||||
git push origin master
|
||||
fi
|
||||
BIN
ci/deploy_key.enc
Normal file
BIN
ci/deploy_key.enc
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue