-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #187 from tegonal/feature/sbt-publish-to-sonatype
introduce sbt-publish-to-sonatype
- Loading branch information
Showing
8 changed files
with
175 additions
and
4 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
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
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
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
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,19 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
shopt -s inherit_errexit | ||
# Assumes tegonal's scripts were fetched with gt - adjust location accordingly | ||
dir_of_tegonal_scripts="$(cd -- "$(dirname -- "${BASH_SOURCE[0]:-$0}")" >/dev/null && pwd 2>/dev/null)/../lib/tegonal-scripts/src" | ||
source "$dir_of_tegonal_scripts/setup.sh" "$dir_of_tegonal_scripts" | ||
|
||
# ask for SONATYPE_USER and SONATYPE_PW (unless already exported beforehand) and calls sbt publishSigned | ||
"$dir_of_tegonal_scripts/releasing/sbt-publish-to-sonatype.sh" | ||
|
||
# predefine SONATYPE_USER, asks for SONATYPE_PW (unless already exported beforehand) and calls sbt publishSigned | ||
SONATYPE_USER="kshjwo2" "$dir_of_tegonal_scripts/releasing/sbt-publish-to-sonatype.sh" | ||
|
||
# if you use it in combination with other files, then you might want to source it instead | ||
sourceOnce "$dir_of_tegonal_scripts/releasing/sbt-publish-to-sonatype.sh" | ||
|
||
# and then call the function | ||
sbtPublishToSonatype | ||
SONATYPE_USER="kshjwo2" sbtPublishToSonatype |
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,77 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# __ __ | ||
# / /____ ___ ____ ___ ___ _/ / This script is provided to you by https://github.com/tegonal/scripts | ||
# / __/ -_) _ `/ _ \/ _ \/ _ `/ / Copyright 2022 Tegonal Genossenschaft <[email protected]> | ||
# \__/\__/\_, /\___/_//_/\_,_/_/ It is licensed under Apache License 2.0 | ||
# /___/ Please report bugs and contribute back your improvements | ||
# | ||
# Version: v3.2.0-SNAPSHOT | ||
####### Description ############# | ||
# | ||
# Checks if (env) var SONATYPE_USER and SONATYPE_PW is set and if not ask the user to input them (via stdin). | ||
# Afterwards it calls `sbt publishSigned` passing the variables without exporting them. | ||
# | ||
####### Usage ################### | ||
# | ||
# #!/usr/bin/env bash | ||
# set -euo pipefail | ||
# shopt -s inherit_errexit | ||
# # Assumes tegonal's scripts were fetched with gt - adjust location accordingly | ||
# dir_of_tegonal_scripts="$(cd -- "$(dirname -- "${BASH_SOURCE[0]:-$0}")" >/dev/null && pwd 2>/dev/null)/../lib/tegonal-scripts/src" | ||
# source "$dir_of_tegonal_scripts/setup.sh" "$dir_of_tegonal_scripts" | ||
# | ||
# # ask for SONATYPE_USER and SONATYPE_PW (unless already exported beforehand) and calls sbt publishSigned | ||
# "$dir_of_tegonal_scripts/releasing/sbt-publish-to-sonatype.sh" | ||
# | ||
# # predefine SONATYPE_USER, asks for SONATYPE_PW (unless already exported beforehand) and calls sbt publishSigned | ||
# SONATYPE_USER="kshjwo2" "$dir_of_tegonal_scripts/releasing/sbt-publish-to-sonatype.sh" | ||
# | ||
# # if you use it in combination with other files, then you might want to source it instead | ||
# sourceOnce "$dir_of_tegonal_scripts/releasing/sbt-publish-to-sonatype.sh" | ||
# | ||
# # and then call the function | ||
# sbtPublishToSonatype | ||
# SONATYPE_USER="kshjwo2" sbtPublishToSonatype | ||
# | ||
################################### | ||
set -euo pipefail | ||
shopt -s inherit_errexit | ||
unset CDPATH | ||
export TEGONAL_SCRIPTS_VERSION='v3.2.0-SNAPSHOT' | ||
|
||
if ! [[ -v dir_of_tegonal_scripts ]]; then | ||
dir_of_tegonal_scripts="$(cd -- "$(dirname -- "${BASH_SOURCE[0]:-$0}")" >/dev/null && pwd 2>/dev/null)/.." | ||
source "$dir_of_tegonal_scripts/setup.sh" "$dir_of_tegonal_scripts" | ||
fi | ||
sourceOnce "$dir_of_tegonal_scripts/utility/log.sh" | ||
sourceOnce "$dir_of_tegonal_scripts/utility/ask.sh" | ||
|
||
function sbtPublishToSonatype() { | ||
local askWithTimeout=60 | ||
|
||
# shellcheck disable=SC2317 # called by name | ||
function sbtPublishToSonatype_noAnswerCallback() { | ||
printf "\n" | ||
die "no user interaction after %s seconds, stop publish process'." "askWithTimeout" | ||
} | ||
|
||
if ! [[ -v SONATYPE_USER ]] || [[ -z "$SONATYPE_USER" ]]; then | ||
askWithTimeout "Please enter the sonatype user token (input is hidden -- will be written to SONATYPE_USER):" \ | ||
"$askWithTimeout" sbtPublishToSonatype_noAnswerCallback SONATYPE_USER "-s" | ||
else | ||
logInfo "SONATYPE_USER already defined" | ||
fi | ||
|
||
if ! [[ -v SONATYPE_PW ]] || [[ -z "$SONATYPE_PW" ]]; then | ||
askWithTimeout "Please enter the sonatype access token (input is hidden -- will be written to SONATYPE_PW):" \ | ||
"$askWithTimeout" sbtPublishToSonatype_noAnswerCallback SONATYPE_PW "-s" | ||
else | ||
logInfo "$SONATYPE_PW already defined" | ||
fi | ||
printf "\n" | ||
SONATYPE_PW="$SONATYPE_PW" SONATYPE_USER="$SONATYPE_USER" sbt publishSigned | ||
} | ||
|
||
${__SOURCED__:+return} | ||
sbtPublishToSonatype "$@" |
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
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