-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add '.bin/' from commit '67bd61eca6af0235ec86e340e8daac9667b1ed0e'
- Loading branch information
Showing
6 changed files
with
226 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Script Documentation | ||
|
||
## [gradlew_gpg](gradlew_gpg) | ||
|
||
Exports a gpg key and executes the `gradlew` in the parent directory. | ||
Any arguments passed to `gradlew_gpg` will be passed to the `gradlew` in the parent directory. | ||
|
||
### Use the key fingerpring | ||
|
||
You can pass the signing key fingerprint as the first argument | ||
|
||
```shell | ||
./gradlew_gpg 1CEFE097A0DC0F8C2F92688 publish | ||
``` | ||
|
||
### Fingerprint as environment variable | ||
|
||
Set the singing key fingerprint as an environment variable. This environment var is then used to look up the key. | ||
|
||
```shell | ||
export GPG_KEY_FINGERPRINT=1CEFE097A0DC0F8C2F92688 | ||
|
||
./gradlew_gpg publish | ||
``` | ||
|
||
|
||
When the script executes it will ask you for the passphrase | ||
|
||
```shell | ||
$ ./gradlew_gpg publish | ||
Enter passphrase: ************** | ||
|
||
> Configure project : | ||
Signing publications | ||
<-------------> 3% EXECUTING [7s] | ||
> :initializeSonatypeStagingRepository | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env bash | ||
|
||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
|
||
function onGitRootDir() { | ||
pushd "$(pwd)" > /dev/null | ||
cd "$(git rev-parse --show-toplevel)" | ||
local command=$1 | ||
shift | ||
$command $* | ||
popd > /dev/null | ||
} | ||
|
||
|
||
function updateSubtree(){ | ||
local repo=$1 | ||
local projectFacet=$2 | ||
local subtree=$3 | ||
local existingSubtrees=$(git log | grep git-subtree-dir | tr -d ' ' | cut -d ":" -f2 | sort | uniq | xargs -I {} bash -c 'if [ -d $(git rev-parse --show-toplevel)/{} ] ; then echo {}; fi') | ||
local subtreeBranchQualifier="${subtree#\.}" | ||
|
||
if [[ ${existingSubtrees} =~ ${subtree} ]]; then | ||
git subtree -P "${subtree}" pull "${repo}" "${projectFacet}/${subtreeBranchQualifier}" | ||
else | ||
local subtreeBranchQualifier="${subtree#\.}" | ||
git subtree -P "${subtree}" add "${repo}/${projectFacet}/${subtreeBranchQualifier}" | ||
fi | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env bash | ||
|
||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
PARENT_DIR="$(dirname "$SCRIPT_DIR")" | ||
|
||
if [ -z "GPG_SIGNING_KEY" ]; then | ||
|
||
if [ -z "$GPG_KEY_FINGERPRINT" ]; then | ||
GPG_KEY_FINGERPRINT=$1 | ||
shift | ||
|
||
if [ "${#GPG_KEY_FINGERPRINT}" -ne 40 ] || ! [[ $GPG_KEY_FINGERPRINT =~ ^[0-9A-Fa-f]{1,}$ ]]; then | ||
echo "First arg must be the 40 character key fingerprint, but was '${GPG_KEY_FINGERPRINT}'" | ||
exit 1 | ||
fi | ||
fi | ||
|
||
if [ -z "GPG_SIGNING_PASSPHRASE" ]; then | ||
echo -n "Enter passphrase: " | ||
unset GPG_SIGNING_PASSPHRASE | ||
while IFS= read -r -s -n1 pass; do | ||
if [[ -z $pass ]]; then | ||
echo | ||
break | ||
else | ||
echo -n '*' | ||
GPG_SIGNING_PASSPHRASE+=$pass | ||
fi | ||
done | ||
export GPG_SIGNING_PASSPHRASE | ||
|
||
|
||
GPG_SIGNING_KEY=$(echo ${GPG_SIGNING_PASSPHRASE} |gpg --pinentry-mode=loopback --passphrase-fd 0 -a --export-secret-keys $GPG_KEY_FINGERPRINT) | ||
export GPG_SIGNING_KEY | ||
fi | ||
fi | ||
|
||
source "${SCRIPT_DIR}/gradlew_utils" | ||
gradlewExec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#!/usr/bin/env bash | ||
|
||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
PARENT_DIR="$(dirname "$SCRIPT_DIR")" | ||
|
||
RELEASE_STRATEGY="patch" | ||
|
||
if [ ! -z "$1" ]; then | ||
RELEASE_STRATEGY="$1" | ||
shift | ||
fi | ||
|
||
function printHelp(){ | ||
>&2 echo "Usage: $(basename "$0") [patch|minor|major]" | ||
} | ||
|
||
function currentVersion() { | ||
echo $(${SCRIPT_DIR}/gradlew properties -q | awk '/^version:/ {print $2}') | ||
} | ||
|
||
increment_version() { | ||
local delimiter=. | ||
local array=($(echo "$1" | tr $delimiter '\n')) | ||
array[$2]=$((array[$2]+1)) | ||
|
||
for (( j=$(($2+1)); j<${#array[@]}; j++ )); | ||
do | ||
array[$j]=0 | ||
done | ||
|
||
echo $(local IFS=$delimiter ; echo "${array[*]}") | ||
} | ||
|
||
shopt -s extglob | ||
case "$RELEASE_STRATEGY" in | ||
"--help" | "-?" ) | ||
printHelp | ||
;; | ||
"patch" ) | ||
# Nothing to do | ||
;; | ||
"minor" ) | ||
CURRENT_VERSION=$(currentVersion) | ||
RELEASE_VERSION=$(increment_version ${CURRENT_VERSION} 1) | ||
;; | ||
"major" ) | ||
CURRENT_VERSION=$(currentVersion) | ||
RELEASE_VERSION=$(increment_version ${CURRENT_VERSION} 0) | ||
;; | ||
+([0-9])?(.+([0-9]))?(.+([0-9])) ) | ||
RELEASE_VERSION="$RELEASE_STRATEGY-SNAPSHOT" | ||
;; | ||
*) | ||
printHelp | ||
;; | ||
esac | ||
|
||
echo "Executing ${RELEASE_STRATEGY} release" | ||
|
||
source "${SCRIPT_DIR}/gradlew_utils" | ||
|
||
if [ ! -z "${RELEASE_VERSION}" ]; then | ||
gradlewExec --info -Prelease.useAutomaticVersion=true -Prelease.newVersion=${RELEASE_VERSION} :updateVersion :commitNewVersion | ||
fi | ||
|
||
gradlewExec --info -Prelease.useAutomaticVersion=true release "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env bash | ||
|
||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
|
||
function findGradlewPath() { | ||
local parent_dir="$(dirname "$SCRIPT_DIR")" | ||
local gradlew_path="$(git rev-parse --show-toplevel)/gradlew" | ||
|
||
if [ -f "${gradlew_path}" ]; then | ||
echo "${gradlew_path}" | ||
return | ||
fi | ||
|
||
echo "" | ||
} | ||
|
||
function gradlewExec(){ | ||
local gradlew="$(findGradlewPath)" | ||
|
||
if ! [ -f "${gradlew}" ]; then | ||
>&2 echo "Gradle Wrapper not found!" | ||
exit 1 | ||
fi | ||
|
||
if [ -x "${gradlew}" ]; then | ||
"${gradlew}" $@ | ||
return | ||
fi | ||
|
||
>&2 echo "Gradle Wrapper is not executable: ${gradlew}" | ||
exit 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env bash | ||
|
||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
source "${SCRIPT_DIR}/git_utils" | ||
|
||
function main(){ | ||
local cmd="$1" | ||
case "${cmd}" in | ||
update) | ||
onGitRootDir updateSubtrees | ||
;; | ||
*) | ||
echo "Usage: $0 update" | ||
;; | ||
esac | ||
} | ||
|
||
function updateSubtrees() { | ||
updateSubtree git-repo-commons gradle .bin | ||
updateSubtree git-repo-commons gradle .github | ||
} | ||
|
||
main "$@"; exit |