Skip to content

Commit c3cf685

Browse files
committed
Rename release validation scripts
1 parent e560428 commit c3cf685

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ The `scripts` folder contains the following scripts:
2727
* `git_default_branch.sh` - Get the default git branch name.
2828
* `package_name.sh` - Get the name of the main Swift package.
2929
* `release.sh` - Make a release build with several validation steps.
30-
* `release_validate.sh` - Validate the current branch for release.
3130
* `sync_from.sh` - Sync `scripts` from a Swift Package Scripts folder.
3231
* `test.sh` - Test a target on all or some platforms.
32+
* `validate_git_branch.sh` - Validate the current branch.
33+
* `validate_release.sh` - Validate the package for release.
3334
* `version_bump.sh` - Bump the current version number and create a new tag.
3435
* `version_number.sh` - Get the current version number from the latest tag.
3536

Sources/SwiftPackageScripts/Documentation.docc/SwiftPackageScripts.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ The `scripts` folder contains the following scripts:
1818
* `git_default_branch.sh` - Get the default git branch name.
1919
* `package_name.sh` - Get the name of the main Swift package.
2020
* `release.sh` - Make a release build with several validation steps.
21-
* `release_validate.sh` - Validate the current branch for release.
2221
* `sync_from.sh` - Sync `scripts` from a Swift Package Scripts folder.
2322
* `test.sh` - Test a target on all or some platforms.
23+
* `validate_git_branch.sh` - Validate the current branch.
24+
* `validate_release.sh` - Validate the package for release.
2425
* `version_bump.sh` - Bump the current version number and create a new tag.
2526
* `version_number.sh` - Get the current version number from the latest tag.
2627

scripts/release_validate_git.sh renamed to scripts/validate_git_branch.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ show_usage() {
99
echo "This script validates the Git repository for release."
1010

1111
echo
12-
echo "Usage: $0 [BRANCH]"
12+
echo "Usage: $0 [BRANCH] [-b|--branch <BRANCH>]"
1313
echo " [BRANCH] Optional. The branch to validate (auto-detects main/master if not specified)"
14+
echo " -b, --branch Optional. The branch to validate"
1415

1516
echo
1617
echo "This script will:"
@@ -23,6 +24,8 @@ show_usage() {
2324
echo " $0"
2425
echo " $0 master"
2526
echo " $0 develop"
27+
echo " $0 -b main"
28+
echo " $0 --branch develop"
2629
echo
2730
}
2831

@@ -50,6 +53,14 @@ BRANCH="" # Will be set to default after parsing
5053
# Parse command line arguments
5154
while [[ $# -gt 0 ]]; do
5255
case $1 in
56+
-b|--branch)
57+
shift # Remove --branch from arguments
58+
if [[ $# -eq 0 || "$1" =~ ^- ]]; then
59+
show_usage_error_and_exit "--branch requires a branch name"
60+
fi
61+
BRANCH="$1"
62+
shift
63+
;;
5364
-h|--help)
5465
show_usage; exit 0 ;;
5566
-*)
@@ -103,4 +114,4 @@ fi
103114
# Complete successfully
104115
echo
105116
echo "Git repository validated successfully!"
106-
echo
117+
echo

scripts/release_validate.sh renamed to scripts/validate_release.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ set -e
66
# Function to display usage information
77
show_usage() {
88
echo
9-
echo "This script validates a <TARGET> for release."
9+
echo "This script validates a <TARGET> for release by checking the git repo, then running lint and unit tests for all platforms."
1010

1111
echo
1212
echo "Usage: $0 [TARGET] [-p|--platforms <PLATFORM1> <PLATFORM2> ...]"
@@ -113,7 +113,7 @@ fi
113113

114114
# Use the script folder to refer to other scripts
115115
FOLDER="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
116-
SCRIPT_VALIDATE_GIT="$FOLDER/release_validate_git.sh"
116+
SCRIPT_VALIDATE_GIT="$FOLDER/validate_git_branch.sh"
117117
SCRIPT_TEST="$FOLDER/test.sh"
118118

119119
# A function that runs a certain script and checks for errors
@@ -153,4 +153,4 @@ run_script "$SCRIPT_TEST" "$TARGET" -p $PLATFORMS
153153
# Complete successfully
154154
echo
155155
echo "Project successfully validated!"
156-
echo
156+
echo

0 commit comments

Comments
 (0)