replace publish.sh with build/release.sh

Former-commit-id: 89636040fe653a0e2917a51fd7e557b0a9d2436c [formerly b052d724fe2381766bfd225d451cc7a077f82db4] [formerly e9e6f9066892058cf2780d33db8e561281bb1597 [formerly 2592c5eb43]]
Former-commit-id: d29d1a3284e7e84c80324d7591623644e5c3fac9 [formerly 3417ad7fe90ed523a0bc9bd67beafbb7b7ff3a80]
Former-commit-id: 5ac4f1ea442c54a401c66203343fa0373b5ffa9c
pull/726/head
1138-4EB 2018-04-18 17:27:28 +02:00
parent 03ab2199d4
commit 292ef7ea8a
4 changed files with 61 additions and 30 deletions

View File

@ -10,8 +10,6 @@ env:
global: global:
- USE_DOCKER="true" - USE_DOCKER="true"
- WDIR=/go/src/github.com/filebrowser/filebrowser - 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: stages:
- lint - lint
- test - test

View File

@ -6,15 +6,18 @@ if [ "$USE_DOCKER" != "" ]; then
if [ -d "frontend/dist" ]; then if [ -d "frontend/dist" ]; then
rm -rf frontend/dist rm -rf frontend/dist
fi; 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 \ $(command -v winpty) docker run -it \
--name filebrowser-tmp \ --name filebrowser-tmp \
-v /$(pwd):/src:z \ -v /$(pwd):/src:z \
-w /${WORKDIR} \ -w /${WDIR} \
filebrowser/dev \ filebrowser/dev \
sh -c "\ sh -c "\
cp -r //src/* /$WORKDIR && \ cp -r //src/* /$WDIR && \
cd build && \ cd build && \
dos2unix build_assets.sh && \ dos2unix build_assets.sh && \
dos2unix build.sh && \ dos2unix build.sh && \
@ -25,10 +28,10 @@ if [ "$USE_DOCKER" != "" ]; then
if [ $exitcode -eq 0 ]; then if [ $exitcode -eq 0 ]; then
for d in "dist/" "node_modules/"; do for d in "dist/" "node_modules/"; do
docker cp filebrowser-tmp:/$WORKDIR/frontend/$d frontend docker cp filebrowser-tmp:/$WDIR/frontend/$d frontend
done done
for d in "vendor/" "rice-box.go" "filebrowser"; do for d in "vendor/" "rice-box.go" "filebrowser"; do
docker cp filebrowser-tmp:/$WORKDIR/$d ./ docker cp filebrowser-tmp:/$WDIR/$d ./
done done
fi fi
docker rm -f filebrowser-tmp docker rm -f filebrowser-tmp

53
build/release.sh Normal file
View File

@ -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!"

View File

@ -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!"