release.sh 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. #!/usr/bin/env bash
  2. set -ex
  3. git config --global user.email "csukuangfj@gmail.com"
  4. git config --global user.name "Fangjun Kuang"
  5. SHERPA_NCNN_VERSION=v$(grep "SHERPA_NCNN_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
  6. echo "========================================================================="
  7. git clone git@github.com:k2-fsa/sherpa-ncnn-go-linux.git
  8. echo "Copy libs for Linux x86_64"
  9. rm -rf sherpa-ncnn-go-linux/lib/x86_64-unknown-linux-gnu/lib*
  10. cp -v ./linux_x86_64/sherpa_ncnn/lib/libkaldi-native-fbank-core.so sherpa-ncnn-go-linux/lib/x86_64-unknown-linux-gnu/
  11. cp -v ./linux_x86_64/sherpa_ncnn/lib/libncnn.so sherpa-ncnn-go-linux/lib/x86_64-unknown-linux-gnu/
  12. cp -v ./linux_x86_64/sherpa_ncnn/lib/libsherpa-ncnn-c-api.so sherpa-ncnn-go-linux/lib/x86_64-unknown-linux-gnu/
  13. cp -v ./linux_x86_64/sherpa_ncnn/lib/libsherpa-ncnn-core.so sherpa-ncnn-go-linux/lib/x86_64-unknown-linux-gnu/
  14. cp -v ./linux_x86_64/sherpa_ncnn.libs/libgomp*.so* sherpa-ncnn-go-linux/lib/x86_64-unknown-linux-gnu/
  15. echo "Copy libs for Linux aarch64"
  16. rm -rf sherpa-ncnn-go-linux/lib/aarch64-unknown-linux-gnu/lib*
  17. cp -v ./linux_aarch64/sherpa_ncnn/lib/libkaldi-native-fbank-core.so sherpa-ncnn-go-linux/lib/aarch64-unknown-linux-gnu/
  18. cp -v ./linux_aarch64/sherpa_ncnn/lib/libncnn.so sherpa-ncnn-go-linux/lib/aarch64-unknown-linux-gnu/
  19. cp -v ./linux_aarch64/sherpa_ncnn/lib/libsherpa-ncnn-c-api.so sherpa-ncnn-go-linux/lib/aarch64-unknown-linux-gnu/
  20. cp -v ./linux_aarch64/sherpa_ncnn/lib/libsherpa-ncnn-core.so sherpa-ncnn-go-linux/lib/aarch64-unknown-linux-gnu/
  21. cp -v ./linux_aarch64/sherpa_ncnn.libs/libgomp*.so* sherpa-ncnn-go-linux/lib/aarch64-unknown-linux-gnu/
  22. echo "Copy sources for Linux"
  23. cp sherpa-ncnn/c-api/c-api.h sherpa-ncnn-go-linux/
  24. cp scripts/go/sherpa_ncnn.go sherpa-ncnn-go-linux/
  25. pushd sherpa-ncnn-go-linux
  26. tag=$(git describe --abbrev=0 --tags)
  27. if [[ x"$VERSION" == x"auto" ]]; then
  28. # this is a pre-release
  29. if [[ $tag == ${SHERPA_NCNN_VERSION}* ]]; then
  30. # echo we have already release pre-release before, so just increment it
  31. last=$(echo $tag | rev | cut -d'.' -f 1 | rev)
  32. new_last=$((last+1))
  33. new_tag=${SHERPA_NCNN_VERSION}-alpha.${new_last}
  34. else
  35. new_tag=${SHERPA_NCNN_VERSION}-alpha.1
  36. fi
  37. else
  38. new_tag=$VERSION
  39. fi
  40. echo "new_tag: $new_tag"
  41. git add .
  42. git status
  43. git commit -m "Release $new_tag" && \
  44. git push && \
  45. git tag $new_tag && \
  46. git push origin $new_tag || true
  47. popd
  48. echo "========================================================================="
  49. git clone git@github.com:k2-fsa/sherpa-ncnn-go-macos.git
  50. echo "Copy libs for macOS x86_64"
  51. rm -rf sherpa-ncnn-go-macos/lib/x86_64-apple-darwin/lib*
  52. cp -v ./macos-x86_64/libkaldi-native-fbank-core.dylib sherpa-ncnn-go-macos/lib/x86_64-apple-darwin
  53. cp -v ./macos-x86_64/libncnn.dylib sherpa-ncnn-go-macos/lib/x86_64-apple-darwin
  54. cp -v ./macos-x86_64/libsherpa-ncnn-c-api.dylib sherpa-ncnn-go-macos/lib/x86_64-apple-darwin
  55. cp -v ./macos-x86_64/libsherpa-ncnn-core.dylib sherpa-ncnn-go-macos/lib/x86_64-apple-darwin
  56. echo "Copy libs for macOS arm64"
  57. rm -rf sherpa-ncnn-go-macos/lib/aarch64-apple-darwin/lib*
  58. cp -v ./macos-arm64/libkaldi-native-fbank-core.dylib sherpa-ncnn-go-macos/lib/aarch64-apple-darwin
  59. cp -v ./macos-arm64/libncnn.dylib sherpa-ncnn-go-macos/lib/aarch64-apple-darwin
  60. cp -v ./macos-arm64/libsherpa-ncnn-c-api.dylib sherpa-ncnn-go-macos/lib/aarch64-apple-darwin
  61. cp -v ./macos-arm64/libsherpa-ncnn-core.dylib sherpa-ncnn-go-macos/lib/aarch64-apple-darwin
  62. echo "Copy sources for macOS"
  63. cp sherpa-ncnn/c-api/c-api.h sherpa-ncnn-go-macos/
  64. cp scripts/go/sherpa_ncnn.go sherpa-ncnn-go-macos/
  65. pushd sherpa-ncnn-go-macos
  66. tag=$(git describe --abbrev=0 --tags)
  67. if [[ x"$VERSION" == x"auto" ]]; then
  68. # this is a pre-release
  69. if [[ $tag == ${SHERPA_NCNN_VERSION}* ]]; then
  70. # echo we have already release pre-release before, so just increment it
  71. last=$(echo $tag | rev | cut -d'.' -f 1 | rev)
  72. new_last=$((last+1))
  73. new_tag=${SHERPA_NCNN_VERSION}-alpha.${new_last}
  74. else
  75. new_tag=${SHERPA_NCNN_VERSION}-alpha.1
  76. fi
  77. else
  78. new_tag=$VERSION
  79. fi
  80. echo "new_tag: $new_tag"
  81. git add .
  82. git status
  83. git commit -m "Release $new_tag" && \
  84. git push && \
  85. git tag $new_tag && \
  86. git push origin $new_tag || true
  87. popd
  88. echo "========================================================================="
  89. git clone git@github.com:k2-fsa/sherpa-ncnn-go-windows.git
  90. echo "Copy libs for Windows x86_64"
  91. rm -fv sherpa-ncnn-go-windows/lib/x86_64-pc-windows-gnu/*
  92. cp -v ./windows-x64/kaldi-native-fbank-core.dll sherpa-ncnn-go-windows/lib/x86_64-pc-windows-gnu
  93. cp -v ./windows-x64/ncnn.dll sherpa-ncnn-go-windows/lib/x86_64-pc-windows-gnu
  94. cp -v ./windows-x64/sherpa-ncnn-c-api.dll sherpa-ncnn-go-windows/lib/x86_64-pc-windows-gnu
  95. cp -v ./windows-x64/sherpa-ncnn-core.dll sherpa-ncnn-go-windows/lib/x86_64-pc-windows-gnu
  96. echo "Copy libs for Windows x86"
  97. rm -fv sherpa-ncnn-go-windows/lib/i686-pc-windows-gnu/*
  98. cp -v ./windows-win32/kaldi-native-fbank-core.dll sherpa-ncnn-go-windows/lib/i686-pc-windows-gnu
  99. cp -v ./windows-win32/ncnn.dll sherpa-ncnn-go-windows/lib/i686-pc-windows-gnu
  100. cp -v ./windows-win32/sherpa-ncnn-c-api.dll sherpa-ncnn-go-windows/lib/i686-pc-windows-gnu
  101. cp -v ./windows-win32/sherpa-ncnn-core.dll sherpa-ncnn-go-windows/lib/i686-pc-windows-gnu
  102. echo "Copy sources for Windows"
  103. cp sherpa-ncnn/c-api/c-api.h sherpa-ncnn-go-windows/
  104. cp scripts/go/sherpa_ncnn.go sherpa-ncnn-go-windows/
  105. pushd sherpa-ncnn-go-windows
  106. tag=$(git describe --abbrev=0 --tags)
  107. if [[ x"$VERSION" == x"auto" ]]; then
  108. # this is a pre-release
  109. if [[ $tag == ${SHERPA_NCNN_VERSION}* ]]; then
  110. # echo we have already release pre-release before, so just increment it
  111. last=$(echo $tag | rev | cut -d'.' -f 1 | rev)
  112. new_last=$((last+1))
  113. new_tag=${SHERPA_NCNN_VERSION}-alpha.${new_last}
  114. else
  115. new_tag=${SHERPA_NCNN_VERSION}-alpha.1
  116. fi
  117. else
  118. new_tag=$VERSION
  119. fi
  120. echo "new_tag: $new_tag"
  121. git add .
  122. git status
  123. git commit -m "Release $new_tag" && \
  124. git push && \
  125. git tag $new_tag && \
  126. git push origin $new_tag || true
  127. popd
  128. echo "========================================================================="
  129. rm -fv ~/.ssh/github