Adds the options to set user details globaly for all repositories
This commit is contained in:
parent
63a636e63f
commit
6ddf7352f1
60
src/octozipo
60
src/octozipo
@ -3,8 +3,8 @@
|
|||||||
# Program name
|
# Program name
|
||||||
PROGRAM_NAME="Octozipo"
|
PROGRAM_NAME="Octozipo"
|
||||||
PROGRAM_CODE="octozipo"
|
PROGRAM_CODE="octozipo"
|
||||||
PROGRAM_VERSION="2.0.1"
|
PROGRAM_VERSION="2.2.1"
|
||||||
PROGRAM_V="2.0"
|
PROGRAM_V="2.2"
|
||||||
# PROGRAM_URL="https://git.vdm.dev/octoleo/${PROGRAM_CODE}"
|
# PROGRAM_URL="https://git.vdm.dev/octoleo/${PROGRAM_CODE}"
|
||||||
|
|
||||||
# Do some prep work
|
# Do some prep work
|
||||||
@ -188,12 +188,14 @@ setNewRepository() {
|
|||||||
setExistingRepository() {
|
setExistingRepository() {
|
||||||
# Notifies the user that the existing repository is being updated.
|
# Notifies the user that the existing repository is being updated.
|
||||||
_echo "[info] Update ($VDM_REPO_NAME) existing repository"
|
_echo "[info] Update ($VDM_REPO_NAME) existing repository"
|
||||||
|
|
||||||
# Checks if there are any changes in the repository.
|
# Checks if there are any changes in the repository.
|
||||||
if [[ -z $(git status --porcelain) ]]; then
|
if [[ -z $(git status --porcelain) ]]; then
|
||||||
# If there are no changes, inform the user.
|
# If there are no changes, inform the user.
|
||||||
_echo "[info] No changes found in ($VDM_REPO_NAME v$VDM_VERSION) repository"
|
_echo "[info] No changes found in ($VDM_REPO_NAME v$VDM_VERSION) repository"
|
||||||
else
|
else
|
||||||
|
# set repository user details
|
||||||
|
setUserDetails
|
||||||
|
|
||||||
# If there are changes, create a commit message.
|
# If there are changes, create a commit message.
|
||||||
commit_msg="update"
|
commit_msg="update"
|
||||||
if ! [ "$(git tag -l "v$VDM_VERSION")" ]; then
|
if ! [ "$(git tag -l "v$VDM_VERSION")" ]; then
|
||||||
@ -275,6 +277,9 @@ setGitInit() {
|
|||||||
# If there are no changes, inform the user.
|
# If there are no changes, inform the user.
|
||||||
_echo "[info] No changes found in repository"
|
_echo "[info] No changes found in repository"
|
||||||
else
|
else
|
||||||
|
# set repository user details
|
||||||
|
setUserDetails
|
||||||
|
|
||||||
# If there are changes, check if a Git tag with the version number exists.
|
# If there are changes, check if a Git tag with the version number exists.
|
||||||
if [ -z "$VDM_VERSION" ] || git tag -l "v$VDM_VERSION" > /dev/null 2>&1; then
|
if [ -z "$VDM_VERSION" ] || git tag -l "v$VDM_VERSION" > /dev/null 2>&1; then
|
||||||
# If it does not exist or if there is no version number, create a commit with the "update" message.
|
# If it does not exist or if there is no version number, create a commit with the "update" message.
|
||||||
@ -309,6 +314,53 @@ setGitInit() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function: setUserDetails
|
||||||
|
# Purpose: Set Git user details based on environment variables
|
||||||
|
#
|
||||||
|
# Arguments:
|
||||||
|
# None
|
||||||
|
#
|
||||||
|
# Environment Variables:
|
||||||
|
# GIT_AUTHOR_NAME - Git author name
|
||||||
|
# GIT_AUTHOR_EMAIL - Git author email
|
||||||
|
# GIT_GPG_SIGN - Git GPG sign (true or false)
|
||||||
|
# GIT_SSH_KEY_PATH - Path to the Git SSH key
|
||||||
|
# GIT_GPG_KEY - Git GPG key
|
||||||
|
#
|
||||||
|
# Returns:
|
||||||
|
# None
|
||||||
|
setUserDetails () {
|
||||||
|
# Set Git author name
|
||||||
|
if [ -n "${GIT_AUTHOR_NAME+x}" ]; then
|
||||||
|
git config user.name "${GIT_AUTHOR_NAME}"
|
||||||
|
_echo "[info] Git author name set to: ${GIT_AUTHOR_NAME}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set Git author email
|
||||||
|
if [ -n "${GIT_AUTHOR_EMAIL+x}" ]; then
|
||||||
|
git config user.email "${GIT_AUTHOR_EMAIL}"
|
||||||
|
_echo "[info] Git author email set to: ${GIT_AUTHOR_EMAIL}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set Git GPG sign
|
||||||
|
if [ -n "${GIT_GPG_SIGN+x}" ]; then
|
||||||
|
git config commit.gpgsign "${GIT_GPG_SIGN}"
|
||||||
|
_echo "[info] Git GPG sign set to: ${GIT_GPG_SIGN}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set Git SSH key path
|
||||||
|
if [ -n "${GIT_SSH_KEY_PATH+x}" ]; then
|
||||||
|
git config core.sshCommand "ssh -i ${GIT_SSH_KEY_PATH}"
|
||||||
|
_echo "[info] Git SSH key path set to: ${GIT_SSH_KEY_PATH}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set Git GPG key
|
||||||
|
if [ -n "${GIT_GPG_KEY+x}" ]; then
|
||||||
|
git config user.signingkey "${GIT_GPG_KEY}"
|
||||||
|
_echo "[info] Git GPG key set to: ${GIT_GPG_KEY}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# setGitCommit - Makes a Git commit with a specified commit message and creates a Git tag
|
# setGitCommit - Makes a Git commit with a specified commit message and creates a Git tag
|
||||||
#
|
#
|
||||||
# setGitCommit adds all changes to the Git index, makes a Git commit with the specified commit message,
|
# setGitCommit adds all changes to the Git index, makes a Git commit with the specified commit message,
|
||||||
@ -821,7 +873,7 @@ function runUpdate() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# set the defaults
|
# set the defaults
|
||||||
VDM_ZIP_DIR="$PWD"
|
: "${VDM_ZIP_DIR:=$PWD}"
|
||||||
VDM_ORG="joomla"
|
VDM_ORG="joomla"
|
||||||
VDM_GIT_URL="git.vdm.dev"
|
VDM_GIT_URL="git.vdm.dev"
|
||||||
VDM_PUSH_CREATE=false
|
VDM_PUSH_CREATE=false
|
||||||
|
Loading…
x
Reference in New Issue
Block a user