generated from AndreasAugustin/template
-
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat/rm need temlateversionrc (#264)
* refact(): move stout and stderr into separate file 🥷 * refact(): move stout and stderr into separate file 🥷 * refact(): #257 no need of .templateversionrc file anymore 🚀 * docs(): #257 update documentation 📝 * fix(): #257 invert logic 🐛
- Loading branch information
1 parent
8aa35f1
commit efdeda5
Showing
14 changed files
with
131 additions
and
81 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 |
---|---|---|
|
@@ -23,3 +23,7 @@ indent_size = 2 | |
[Makefile] | ||
indent_style = tab | ||
indent_size = 4 | ||
|
||
[*.sh] | ||
indent_size = 2 | ||
indent_style = tab |
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 was deleted.
Oops, something went wrong.
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 @@ | ||
node_modules/ |
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -3,13 +3,16 @@ set -e | |
# set -u | ||
set -x | ||
|
||
# shellcheck source=src/sync_common.sh | ||
source sync_common.sh | ||
|
||
[ -z "${GITHUB_TOKEN}" ] && { | ||
echo "::error::Missing input 'github_token: \${{ secrets.GITHUB_TOKEN }}'."; | ||
err "Missing input 'github_token: \${{ secrets.GITHUB_TOKEN }}'."; | ||
exit 1; | ||
}; | ||
|
||
if [[ -z "${SOURCE_REPO_PATH}" ]]; then | ||
echo "::error::Missing input 'source_repo_path: \${{ input.source_repo_path }}'.;" | ||
err "Missing input 'source_repo_path: \${{ input.source_repo_path }}'."; | ||
exit 1 | ||
fi | ||
|
||
|
@@ -18,28 +21,43 @@ SOURCE_REPO_HOSTNAME="${HOSTNAME:-github.com}" | |
# In case of private template repository this will be overwritten | ||
SOURCE_REPO_PREFIX="https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@${SOURCE_REPO_HOSTNAME}/" | ||
|
||
# Forward to /dev/null to swallow the output of the private key | ||
if [[ -n "${SSH_PRIVATE_KEY_SRC}" ]] &>/dev/null; then | ||
function ssh_setup() { | ||
echo "::group::ssh setup" | ||
|
||
info "prepare ssh" | ||
SRC_SSH_FILE_DIR="/tmp/.ssh" | ||
SRC_SSH_PRIVATEKEY_FILE_NAME="id_rsa_actions_template_sync" | ||
export SRC_SSH_PRIVATEKEY_ABS_PATH="${SRC_SSH_FILE_DIR}/${SRC_SSH_PRIVATEKEY_FILE_NAME}" | ||
echo "::debug::We are using SSH within a private source repo" | ||
debug "We are using SSH within a private source repo" | ||
mkdir -p "${SRC_SSH_FILE_DIR}" | ||
# use cat <<< instead of echo to swallow output of the private key | ||
cat <<< "${SSH_PRIVATE_KEY_SRC}" | sed 's/\\n/\n/g' > "${SRC_SSH_PRIVATEKEY_ABS_PATH}" | ||
chmod 600 "${SRC_SSH_PRIVATEKEY_ABS_PATH}" | ||
SOURCE_REPO_PREFIX="git@${SOURCE_REPO_HOSTNAME}:" | ||
|
||
echo "::endgroup::" | ||
} | ||
|
||
# Forward to /dev/null to swallow the output of the private key | ||
if [[ -n "${SSH_PRIVATE_KEY_SRC}" ]] &>/dev/null; then | ||
ssh_setup | ||
fi | ||
|
||
export SOURCE_REPO="${SOURCE_REPO_PREFIX}${SOURCE_REPO_PATH}" | ||
|
||
echo "::group::git init" | ||
echo "set git global configuration" | ||
git config --global user.email "[email protected].${SOURCE_REPO_HOSTNAME}" | ||
git config --global user.name "${GITHUB_ACTOR}" | ||
git config --global pull.rebase false | ||
git config --global --add safe.directory /github/workspace | ||
echo "::endgroup::" | ||
function git_init() { | ||
echo "::group::git init" | ||
info "set git global configuration" | ||
|
||
git config --global user.email "[email protected].${SOURCE_REPO_HOSTNAME}" | ||
git config --global user.name "${GITHUB_ACTOR}" | ||
git config --global pull.rebase false | ||
git config --global --add safe.directory /github/workspace | ||
|
||
echo "::endgroup::" | ||
} | ||
|
||
git_init | ||
|
||
# shellcheck source=src/sync_template.sh | ||
source sync_template.sh |
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,41 @@ | ||
#! /usr/bin/env bash | ||
|
||
set -e | ||
# set -u | ||
set -x | ||
|
||
####################################### | ||
# write a message to STDERR. | ||
# Arguments: | ||
# message to print. | ||
####################################### | ||
err() { | ||
echo "::error::[$(date +'%Y-%m-%dT%H:%M:%S%z')]: $*" >&2; | ||
} | ||
|
||
####################################### | ||
# write a debug message. | ||
# Arguments: | ||
# message to print. | ||
####################################### | ||
debug() { | ||
echo "::debug::$*"; | ||
} | ||
|
||
####################################### | ||
# write a warn message. | ||
# Arguments: | ||
# message to print. | ||
####################################### | ||
warn() { | ||
echo "::warn::$*"; | ||
} | ||
|
||
####################################### | ||
# write a info message. | ||
# Arguments: | ||
# message to print. | ||
####################################### | ||
info() { | ||
echo "::info::$*"; | ||
} |
Oops, something went wrong.