2
0

make-release.sh 602 B

12345678910111213141516171819202122232425262728
  1. #!/usr/bin/env bash
  2. set -euo pipefail
  3. if [[ "${GITHUB_REF:-}" == refs/tags/* ]]; then
  4. version=${GITHUB_REF/refs\/tags\//}
  5. else
  6. version="v$(jq -r .version package.json)"
  7. if git ls-remote --tags --exit-code origin "$version"; then
  8. echo "Release $release_name already exists"
  9. exit 1
  10. fi
  11. fi
  12. release_name="typingfreaks-$version"
  13. npm run build
  14. function cleanup {
  15. rm -rf "$release_name"
  16. rm -f "$release_name.zip"
  17. }
  18. trap cleanup EXIT
  19. mv dist "$release_name"
  20. zip -r "$release_name.zip" "$release_name"
  21. gh release create -d --notes "" "$version" "$release_name.zip"