From 292ef7ea8ab6ea05dcd2c59251066aeb8840786c Mon Sep 17 00:00:00 2001 From: 1138-4EB <1138-4EB@users.noreply.github.com> Date: Wed, 18 Apr 2018 17:27:28 +0200 Subject: [PATCH] replace publish.sh with build/release.sh Former-commit-id: 89636040fe653a0e2917a51fd7e557b0a9d2436c [formerly b052d724fe2381766bfd225d451cc7a077f82db4] [formerly e9e6f9066892058cf2780d33db8e561281bb1597 [formerly 2592c5eb4347bf7eb65756818653849f19f5e0ff]] Former-commit-id: d29d1a3284e7e84c80324d7591623644e5c3fac9 [formerly 3417ad7fe90ed523a0bc9bd67beafbb7b7ff3a80] Former-commit-id: 5ac4f1ea442c54a401c66203343fa0373b5ffa9c --- .travis.yml | 2 -- build/build_all.sh | 13 +++++++----- build/release.sh | 53 ++++++++++++++++++++++++++++++++++++++++++++++ publish.sh | 23 -------------------- 4 files changed, 61 insertions(+), 30 deletions(-) create mode 100644 build/release.sh delete mode 100644 publish.sh diff --git a/.travis.yml b/.travis.yml index 8a0c37df..27334cc1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,8 +10,6 @@ env: global: - USE_DOCKER="true" - WDIR=/go/src/github.com/filebrowser/filebrowser - - secure: YtxLrM3z2A/wDh5yLXrMXgsMRr+c7v5auS/2SpNxra0E6fcFKNPtk2g6JB4JfpFRp6feeuwtT61b16OdHjNVcwtZPLEdM1o7nUaLd+UxxKYlXwMSl+Hqaclx5KbBwlVCU3BKJjPVY/RujjSgOGG7C9b40E8YBssVIxyM51qV+u4C7Odu99ZC42OnFG8n+SsdP2xdI7BFw5qJTmNAgnns4QEAiZi++YMtsYmoo828mNpYX093N1VeW81JHeHo82Xwifpeij2fxuOkGAf2JMOuYrH+Mn+jgAiSUGkNRKhaA5do3ov6tSiCWZtQjrAIFk56knXaeeIO+ysryJ+BO9w2qquI1IYktpIemZjjoz24qKeUY0suxPdEe7cH17/P6n2LHUyXiUyUpjRX2bFqo6kfAoMc6oPqgOWu8Ls5GwuEHqCwsZXTVy4ZqNYiAIgk85lUecm9uy+Ubtu4bCdJpDlkC9jGow4Wn/6lHNxsuGWfBR1P94WtC+qmrZf/xje3A5xKATtZtLrfc0tLdsH5VYDyIZ4WYWOIrCemayjXK3RJxN+qQDxaPWPG0cmHAxPslUyHE1eDxy1hCkCZx82Qjr1dX8Xx5tO4SoBayV9pmJo4+IyEb711NQyYrA/EdDswMmrVJNLBY+yDK6umkMlcIuRkVQanOydgRrusbKuQoAGOQRE= - - secure: d+4aM/IGqszna5Yv7M+6wWmdzafSkPH5qJtvd5Jac6QUxMhDIzIN+br+Sf2PNougZso7EsaFHlZQKatSmCM+DsVy2Ke5DB82icTsMyBzano8GF+eYm9BJUhgOk933ygsDKRFvfaiwAPjGgyFDwLAc4CPc/Lly/mqs4wyyekFgTWvIF+AG9GaigCkQB14Ud70BJ0PBCGh82lqKSY32r7ti/G5uNrD5DFIOpUmoq9NWeX7tAvWi6iWWCdndmAnT7aRpb7oprgMTm4Jc7CguJvz2pKh6a2ncY29nuvr0DNEfXRGiGKAZAck852ad/pwSa04Uwi1j5arFAZuRgtldhksFQPWZM4s7SP9e6LpSWU4+QyuXY5R1Rs5KtdREd3J27z2RmFm0m5vMkUTGMMHvw+qOrITVovWKme+ptOKytpIVgoxmzA/Y2/aS0JxN78nuLfX5v24+yDQ1aIxtjTzQufkGyFPMqwDPV0ZO5/Ez0FP1lPWd5cRrL77ako1sTVje4Up08VwcmJueJH2Xv7YfmvYR0w/VMymEliKpDsTJ6A7/o+Y2gyi6mwTjg7q/6aXTBoxVH/3LFABJeBQWqhIaDTdk5xjutEGUKyUMoHjW6fqTvoErLRfwz8dSh1GBtLNz7AqVd2v7tnVzo0iFPIlyqvhUiHQX7M0+lPOz0hQ581VlHw= stages: - lint - test diff --git a/build/build_all.sh b/build/build_all.sh index ac14d211..46ef4a11 100755 --- a/build/build_all.sh +++ b/build/build_all.sh @@ -6,15 +6,18 @@ if [ "$USE_DOCKER" != "" ]; then if [ -d "frontend/dist" ]; then rm -rf frontend/dist fi; - WORKDIR="/go/src/github.com/filebrowser/filebrowser" + + if [ "$WDIR" = "" ]; then + WDIR="/go/src/github.com/filebrowser/filebrowser" + fi; $(command -v winpty) docker run -it \ --name filebrowser-tmp \ -v /$(pwd):/src:z \ - -w /${WORKDIR} \ + -w /${WDIR} \ filebrowser/dev \ sh -c "\ - cp -r //src/* /$WORKDIR && \ + cp -r //src/* /$WDIR && \ cd build && \ dos2unix build_assets.sh && \ dos2unix build.sh && \ @@ -25,10 +28,10 @@ if [ "$USE_DOCKER" != "" ]; then if [ $exitcode -eq 0 ]; then for d in "dist/" "node_modules/"; do - docker cp filebrowser-tmp:/$WORKDIR/frontend/$d frontend + docker cp filebrowser-tmp:/$WDIR/frontend/$d frontend done for d in "vendor/" "rice-box.go" "filebrowser"; do - docker cp filebrowser-tmp:/$WORKDIR/$d ./ + docker cp filebrowser-tmp:/$WDIR/$d ./ done fi docker rm -f filebrowser-tmp diff --git a/build/release.sh b/build/release.sh new file mode 100644 index 00000000..1d4b831b --- /dev/null +++ b/build/release.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +cd $(dirname $0)/.. + +echo "> Checking semver format" + +if [ $# -ne 1 ]; then + echo "This release script requires a single argument corresponding to the semver to be released. See semver.org" + exit 1 +fi + +semver=$(grep -P '^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)' <<< "$1") + +if [ $? -ne 0 ]; then + echo "Not valid semver format. See semver.org" + exit 1 +fi + +echo "> Checking matching $semver in frontend submodule" + +cd frontend + +trash=$(git tag | grep "$semver") +if [ $? -ne 0 ]; then + echo "Tag $semver does not exist in submodule 'frontend'. Tag it and run this script again." + exit 1 +fi + +git rev-parse --verify --quiet release +if [ $? -ne 0 ]; then + git checkout -b release "$semver" +else + git checkout release + git reset --hard "$semver" +fi + +cd .. + +echo "> Updating submodule ref to $semver" + +sed -i "s|(untracked)|$1|g" filebrowser.go +git commit -am "chore: version $semver" +git tag "$1" +git push +git push --tags + +echo "> Commiting untracked version notice..." + +sed -i "s|$1|(untracked)|g" filebrowser.go +git commit -am "chore: setting untracked version [ci skip]" +git push + +echo "> Done!" diff --git a/publish.sh b/publish.sh deleted file mode 100644 index 660ce463..00000000 --- a/publish.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -set -e - -cd $(dirname $0) - -echo "Building assets" -./build/build_assets.sh - -echo "Updating version number to $1..." -sed -i "s|(untracked)|$1|g" filebrowser.go -git add -A -git commit -m "chore: version $1" -git tag "v$1" -git push -git push --tags - -echo "Commiting untracked version notice..." -sed -i "s|$1|(untracked)|g" filebrowser.go -git add -A -git commit -m "chore: setting untracked version [ci skip]" -git push - -echo "Done!"