diff --git a/Configurations/make-release-package.sh b/Configurations/make-release-package.sh index 55037204..23afe66d 100755 --- a/Configurations/make-release-package.sh +++ b/Configurations/make-release-package.sh @@ -55,6 +55,8 @@ if [ "$ACTION" = "" ] ; then # Get latest git tag cd "$SRCROOT" latest_git_tag=$(git describe --abbrev=0) + # Check semantic versioning + [[ $latest_git_tag =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\\+([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))?$ ]] && echo "Tag $latest_git_tag follows semantic versioning" || echo "WARNING: Tag $latest_git_tag does not follow semantic versioning! SPM will not be able to resolve the repository" # Generate new Package manifest cd "$CONFIGURATION_BUILD_DIR" cp "$SRCROOT/Package.swift" "$CONFIGURATION_BUILD_DIR" diff --git a/Configurations/release-move-tag.sh b/Configurations/release-move-tag.sh index 5f3e029e..7a5edbcb 100755 --- a/Configurations/release-move-tag.sh +++ b/Configurations/release-move-tag.sh @@ -10,9 +10,11 @@ if [ "$commits_since_tag" -gt 0 ]; then echo "Package.swift has not been committed and tag has not been moved." else # TODO: add sanity check to see if version is actually being updated or not? - read -p "Do you want to commit changes to Package.swift and force move tag '$latest_git_tag'? (required for SPM release) [y/N]" -n 1 -r + read -p "Do you want to commit changes to Package.swift and force move tag '$latest_git_tag'? (required for SPM release) [Y/n]" -n 1 -r echo # (optional) move to a new line - if [[ $REPLY =~ ^[Yy]$ ]]; then + if [[ $REPLY =~ ^[Nn]$ ]]; then + echo "Package.swift has not been committed and tag has not been moved." + else long_message=$(git tag -n99 -l $latest_git_tag) # gets corresponding message long_message=${long_message/$latest_git_tag} # trims tag name long_message="$(echo -e "${long_message}" | sed -e 's/^[[:space:]]*//')" # trim leading whitespace @@ -20,7 +22,5 @@ else git commit -m "Update Package.swift" git tag -fa $latest_git_tag -m "${long_message}" echo "Package.swift committed and tag '$latest_git_tag' moved." - else - echo "Package.swift has not been committed and tag has not been moved." fi fi