From 652d043c313a0f5b3b7b02c85fd4b7a215d052ff Mon Sep 17 00:00:00 2001 From: NI Date: Sun, 11 Aug 2019 16:04:20 +0800 Subject: [PATCH] Fix .travis.yml --- .travis.yml | 50 +++++++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/.travis.yml b/.travis.yml index e6a3e7d5..5d0757e7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ env: - BUILD_TARGETS="darwin/386 darwin/amd64 windows/386 windows/amd64 openbsd/386 openbsd/amd64 openbsd/arm openbsd/arm64 freebsd/386 freebsd/amd64 freebsd/arm freebsd/arm64 linux/386 linux/amd64 linux/arm linux/arm64 linux/ppc64 linux/ppc64le linux/mips linux/mipsle linux/mips64 linux/mips64le" - SSHWIFTY_VERSION=$(git describe --always --dirty='*' --tag) - SSHWIFTY_COMMIT=$(git describe --always) - - SSHWIFTY_RELEASE=$([[ "$SSHWIFTY_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9.]+\-[a-zA-Z0-9\-]+$ ]] && echo "yes") + - SSHWIFTY_RELEASE=$([[ "$SSHWIFTY_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+\-[a-zA-Z0-9]+\-release$ ]] && echo "yes") - SSHWIFTY_DEPLOY=$([[ "$SSHWIFTY_RELEASE" != "yes" || "$GITHUB_USER" == "" || "$GITHUB_TOKEN" == "" ]] || echo "yes") - SSHWIFTY_TEST_COVER=$([[ "$COVERALLS_TOKEN" == "" ]] || echo "yes") @@ -19,6 +19,7 @@ branches: only: - master - dev + - /^[0-9]+\.[0-9]+\.[0-9]+\-[a-zA-Z0-9]+\-release$/ go: - stable @@ -49,31 +50,34 @@ after_success: fi before_deploy: - - curl "$ASC_URL" | gpg --import - - mkdir -p ./.tmp/deploy - - CGO_ENABLED=0 gox -ldflags "-s -w -X $VERSION_VARIABLE=$SSHWIFTY_VERSION" -osarch "$BUILD_TARGETS" -output "./.tmp/deploy/{{.Dir}}_$SSHWIFTY_VERSION_{{.OS}}_{{.Arch}}/{{.Dir}}_{{.OS}}_{{.Arch}}" - - echo $(git show "$SSHWIFTY_COMMIT" --show-signature --shortstat) > ./.tmp/deploy/Note - - echo "echo Preparing for \$1 ..." > prepare.sh - - echo "(cd \$1 && find . -maxdepth 1 -type f ! -name \"SUM.*\" -exec sha512sum {} \; > SUM.sha512);" >> prepare.sh - - echo "(cp *.md \$1/);" >> prepare.sh - - echo "(cp ./.tmp/deploy/Note \$1/);" >> prepare.sh - - echo "(cp ./sshwifty.conf.example.json \$1/);" >> prepare.sh - - echo "(cd \$1/ && tar -zcvf \"../\$(basename \$(pwd)).tar.gz\" *);" >> prepare.sh - - chmod +x ./prepare.sh - - find ./.tmp/deploy/ -maxdepth 1 -type d ! -name "deploy" -exec ./prepare.sh {} \; - - rm ./prepare.sh -f - - find ./.tmp/deploy/ -maxdepth 1 -type d ! -name "deploy" -exec rm {} -rf \; - - find ./.tmp/deploy/ -maxdepth 1 -type f -name "*.tar.gz" -execdir sha512sum {} \; > ./.tmp/deploy/SUM.sha512 - - echo "$GITHUB_USER" > ./deploy_user - - echo "$SSHWIFTY_VERSION" > ./deploy_title - - echo "ghr -u \"\$(cat ./deploy_user)\" -b \"\$(cat ./.tmp/deploy/Note)\" -delete -prerelease \"\$(cat ./deploy_title)\" ./.tmp/deploy" > ./deploy.sh - - chmod +x ./deploy.sh - - cat ./.tmp/deploy/SUM.sha512 + - | + if [[ "$SSHWIFTY_DEPLOY" == yes ]]; then + curl "$ASC_URL" | gpg --import + mkdir -p ./.tmp/deploy + CGO_ENABLED=0 gox -ldflags "-s -w -X $VERSION_VARIABLE=$SSHWIFTY_VERSION" -osarch "$BUILD_TARGETS" -output "./.tmp/deploy/{{.Dir}}_$(echo $SSHWIFTY_VERSION)_{{.OS}}_{{.Arch}}/{{.Dir}}_{{.OS}}_{{.Arch}}" + echo $(git show "$SSHWIFTY_COMMIT" --show-signature --shortstat) > ./.tmp/deploy/Note + echo 'echo Preparing for $1 ...;' > prepare.sh + echo '(cd $1/ && find . -maxdepth 1 -type f ! -name "SUM.*" -exec sha512sum {} \; > SUM.sha512);' >> prepare.sh + echo '(cp *.md $1/);' >> prepare.sh + echo '(cp ./.tmp/deploy/Note $1/);' >> prepare.sh + echo '(cp ./sshwifty.conf.example.json $1/);' >> prepare.sh + echo '(cd $1/ && tar -zcvf "../$(basename $(pwd)).tar.gz" *);' >> prepare.sh + chmod +x ./prepare.sh + find ./.tmp/deploy/ -maxdepth 1 -type d ! -name "deploy" -exec ./prepare.sh {} \; + rm ./prepare.sh -f + find ./.tmp/deploy/ -maxdepth 1 -type d ! -name "deploy" -exec rm {} -rf \; + find ./.tmp/deploy/ -maxdepth 1 -type f -name "*.tar.gz" -execdir sha512sum {} \; > ./.tmp/deploy/SUM.sha512 + echo "$GITHUB_USER" > ./deploy_user + echo "$SSHWIFTY_VERSION-prebuild" > ./deploy_title + echo 'ghr -u "$(cat ./deploy_user)" -b "$(cat ./.tmp/deploy/Note)" -delete -prerelease "$(cat ./deploy_title)" ./.tmp/deploy' > ./deploy.sh + chmod +x ./deploy.sh + cat ./.tmp/deploy/SUM.sha512 + fi deploy: provider: script script: ./deploy.sh skip_cleanup: true on: - branch: master - condition: $SSHWIFTY_DEPLOY = "yes" + all_branches: true + condition: $SSHWIFTY_DEPLOY = yes