pub.sh 666 B

123456789101112131415161718192021222324252627
  1. #!/bin/bash
  2. REALPATH=$(realpath $0)
  3. WORK_DIR=$(cd $(dirname $REALPATH)/.. && pwd)
  4. echo "Run pub at $WORK_DIR from $0"
  5. cd $WORK_DIR
  6. git st |grep -q 'nothing to commit'
  7. if [[ $? -ne 0 ]]; then
  8. echo "Failed: Please commit before release";
  9. exit 1
  10. fi
  11. RELEASE=$(git describe --tags --abbrev=0 --exclude release-*)
  12. REVISION=$(echo $RELEASE|awk -F . '{print $3}')
  13. let NEXT=$REVISION+1
  14. echo "Last release is $RELEASE, revision is $REVISION, next is $NEXT"
  15. TAG="v1.0.$NEXT"
  16. echo "publish $TAG"
  17. git push
  18. git tag -d $TAG 2>/dev/null && git push origin :$TAG
  19. git tag $TAG
  20. git push origin $TAG
  21. echo "publish $TAG ok"
  22. echo " https://github.com/ossrs/signaling/actions"