upgrade.sh 844 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/bin/bash
  2. docker-compose down
  3. git checkout current
  4. TAG=$(git describe --tags)
  5. git fetch --tags
  6. # select from last 5 tags
  7. if [ latestTag="" ] ; then
  8. PS3="Enter number of version: "
  9. select version in $(git tag -l | tail -5)
  10. do
  11. latestTag=$version;
  12. echo "Upgrading to $version ..."
  13. break;
  14. done
  15. fi
  16. # or use latest
  17. # latestTag=$(git tag -l | tail -1`)
  18. # update upstream
  19. git branch -D upstream
  20. git pull
  21. git checkout $latestTag
  22. git switch -c upstream
  23. # fix permission and rebuild
  24. chmod +x docker-entrypoint.sh
  25. chmod +x ./scripts/auth-su.sh
  26. ./scripts/auth-su.sh user
  27. docker build --tag umap:$latestTag .
  28. # fix permission
  29. chmod +x ./scripts/auth-su.sh
  30. ./scripts/auth-su.sh
  31. # restart
  32. sed -i 's/umap:'${TAG}'/umap:'${latestTag}'/g' docker-compose.yml;
  33. docker-compose up -d;
  34. # resync current
  35. git branch -D current
  36. git branch current