-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathpackage_version.sh
More file actions
executable file
·28 lines (21 loc) · 898 Bytes
/
package_version.sh
File metadata and controls
executable file
·28 lines (21 loc) · 898 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
# Documentation:
# This script creates a new version for `Package.swift`.
# You can pass in a <BRANCH> to validate any non-main branch.
# Usage:
# package_version.sh <BRANCH default:main>
# e.g. `bash scripts/package_version.sh master`
# Exit immediately if a command exits with non-zero status
set -e
# Use the script folder to refer to other scripts.
FOLDER="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
SCRIPT_BRANCH_NAME="$FOLDER/git_default_branch.sh"
SCRIPT_PACKAGE_NAME="$FOLDER/package_name.sh"
SCRIPT_VERSION="$FOLDER/version.sh"
# Get branch name
DEFAULT_BRANCH=$("$SCRIPT_BRANCH_NAME") || { echo "Failed to get branch name"; exit 1; }
BRANCH_NAME=${1:-$DEFAULT_BRANCH}
# Get package name
PACKAGE_NAME=$("$SCRIPT_PACKAGE_NAME") || { echo "Failed to get package name"; exit 1; }
# Build package version
bash $SCRIPT_VERSION $PACKAGE_NAME $BRANCH_NAME