diff --git a/.travis.yml b/.travis.yml index 0de98adb..99187c03 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,6 +44,7 @@ jobs: - ./build/docker_login.sh - docker run --rm -itv $(pwd):$WDIR -v /var/run/docker.sock:/var/run/docker.sock filebrowser/dev goreleaser - docker logout + - ./build/push_ricebox.sh if: tag IS present deploy: provider: releases diff --git a/build/push_ricebox.sh b/build/push_ricebox.sh new file mode 100755 index 00000000..12f1ffd5 --- /dev/null +++ b/build/push_ricebox.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +cd $(dirname $0) + +COMMIT_SHA="$(git rev-parse --verify HEAD | cut -c1-8)" + +eval `ssh-agent -s` +openssl aes-256-cbc -K $encrypted_9ca81b5594f5_key -iv $encrypted_9ca81b5594f5_iv -in ./deploy_key.enc -d | ssh-add - + +git clone git@github.com:filebrowser/caddy caddy +cd caddy +cp ../../rice-box.go assets/ +git checkout -b update-rice-box origin/master +git commit -am "update rice-box $COMMIT_SHA" + +if [ $(git tag | grep "$TRAVIS_TAG" | wc -l) -ne 0 ]; then + git tag -d "$TRAVIS_TAG" +fi + +git tag "$TRAVIS_TAG" + +if [ "$(git ls-remote --heads origin update-rice-box)" != "" ]; then + git push -u origin update-rice-box +else + git push origin +update-rice-box +fi + +if [ "$(git ls-remote --heads origin update-rice-box)" != "" ]; then + git push origin "$TRAVIS_TAG" +else + git push origin :"$TRAVIS_TAG" + git push origin "$TRAVIS_TAG" +fi + diff --git a/build/release.sh b/build/release.sh index b91c83fc..cf285d46 100644 --- a/build/release.sh +++ b/build/release.sh @@ -21,8 +21,7 @@ echo "> Checking matching $semver in frontend submodule" cd frontend git fetch --all -trash=$(git tag | grep "$semver") -if [ $? -ne 0 ]; then +if [ $(git tag | grep "$semver" | wc -l) -eq 0 ]; then echo "Tag $semver does not exist in submodule 'frontend'. Tag it and run this script again." exit 1 fi