[Project] remove unused scripts
This commit is contained in:
parent
35bf3ca68e
commit
b5179e80ae
136
autoRelease.sh
136
autoRelease.sh
|
@ -1,136 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# usage
|
|
||||||
if [ $# != 1 ] ; then
|
|
||||||
echo -e "Usage: ${0} <release_branch>"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
releaseBranch="${1}"
|
|
||||||
|
|
||||||
lastTag="$(git for-each-ref --format="%(refname)" --sort=-taggerdate --count=1 refs/tags | cut -d '/' -f 3)"
|
|
||||||
if [[ "${lastTag}" == '' ]] ; then
|
|
||||||
lastTag="0.0.0"
|
|
||||||
majorVersion="1"
|
|
||||||
minorVersion="0"
|
|
||||||
updateVersion="0"
|
|
||||||
newUpdateVersion="0"
|
|
||||||
else
|
|
||||||
majorVersion=$(echo $lastTag | cut -d '.' -f 1)
|
|
||||||
minorVersion=$(echo $lastTag | cut -d '.' -f 2)
|
|
||||||
updateVersion=$(echo $lastTag | cut -d '.' -f 3)
|
|
||||||
newUpdateVersion=$((updateVersion+1))
|
|
||||||
fi
|
|
||||||
|
|
||||||
newVersion="${majorVersion}.${minorVersion}.${newUpdateVersion}"
|
|
||||||
|
|
||||||
## Make sure no changes
|
|
||||||
if ! git diff-index --quiet HEAD -- ; then
|
|
||||||
echo "ERROR: You have unsaved changes."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# cleanup trap
|
|
||||||
function cleanup {
|
|
||||||
echo -e "\nINFO: Cleaning up..."
|
|
||||||
git checkout ${releaseBranch}
|
|
||||||
git checkout .
|
|
||||||
git branch -D temp
|
|
||||||
}
|
|
||||||
trap cleanup EXIT
|
|
||||||
|
|
||||||
# Confirm
|
|
||||||
echo -e "INFO: Previous tag: ${lastTag}"
|
|
||||||
echo -e "INFO: Do you want to create release ${newVersion} from release branch ${releaseBranch}? y/n"
|
|
||||||
read a
|
|
||||||
if [[ "${a}" != "y" && "${a}" != "Y" ]] ; then
|
|
||||||
exit 0;
|
|
||||||
fi
|
|
||||||
|
|
||||||
# validate tag does not exist
|
|
||||||
echo -e "INFO: Fetching tags and branches and validating they do not exist..."
|
|
||||||
if ! git fetch --all --tags > /dev/null ; then
|
|
||||||
echo -e "ERROR: Tags and branches could not be fetched!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if git tag | grep ${newVersion} > /dev/null ; then
|
|
||||||
echo -e "ERROR: Tag already exists!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# make sure gpg-agent is available and loaded
|
|
||||||
echo -e "\nINFO: Searching for gpg-agent..."
|
|
||||||
if ! which gpg-agent ; then
|
|
||||||
echo -e "ERROR: gpg-agent missing!"
|
|
||||||
fi
|
|
||||||
if ! gpg-agent 2>&1 | grep "running and available" ; then
|
|
||||||
echo -e "WARN: gpg-agent not running, trying to start..."
|
|
||||||
if ! gpg-agent --daemon ; then
|
|
||||||
echo -e "ERROR: Failed to initialize gpg-agent, please make sure it is up and running before continuing!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if ! gpg-agent 2>&1 | grep "running and available" ; then
|
|
||||||
echo -e "ERROR: Failed to initialize gpg-agent, please make sure it is up and running before continuing!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Checkout release branch
|
|
||||||
echo -e "\nINFO: Checking out release branch ${releaseBranch}"
|
|
||||||
if ! git checkout ${releaseBranch} ; then
|
|
||||||
echo -e "ERROR: Failed to checkout branch ${releaseBranch}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# create temp branch
|
|
||||||
echo -e "\nINFO: Creating temp branch..."
|
|
||||||
if ! git checkout -b temp ; then
|
|
||||||
echo -e "ERROR: Failed to create temp branch!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# set release version
|
|
||||||
echo -e "\nINFO: Setting version..."
|
|
||||||
if ! mvn versions:set -DgenerateBackupPoms=false -DnewVersion=${newVersion} > /dev/null ; then
|
|
||||||
echo -e "ERROR: Failed to set new version!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# build
|
|
||||||
echo -e "\nINFO: Doing a build with new version..."
|
|
||||||
if ! mvn clean package -DskipTests > /dev/null ; then
|
|
||||||
echo -e "ERROR: Failed to build with new version!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# commit to tag
|
|
||||||
echo -e "\nINFO: Creating tag..."
|
|
||||||
if ! git add . ; then
|
|
||||||
echo -e "ERROR: Failed to git add"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if ! git commit -m "[Project] Set new version ${newVersion}" ; then
|
|
||||||
echo -e "ERROR: Failed to git commit"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if ! git tag --sign --message "[Project] New Version ${newVersion}" ${newVersion} ; then
|
|
||||||
echo -e "ERROR: Failed to git tag"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# local install
|
|
||||||
echo -e "\nINFO: Installing new version..."
|
|
||||||
if ! mvn source:jar install -DskipTests > /dev/null ; then
|
|
||||||
echo -e "ERROR: Failed to install new version!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# git push
|
|
||||||
if ! git push origin ${newVersion} ; then
|
|
||||||
echo -e "ERROR: Failed to push tag"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo -e "\nINFO: Pushed release tag ${newVersion}"
|
|
||||||
|
|
||||||
echo -e "\nINFO: Release ${newVersion} created."
|
|
||||||
exit 0
|
|
|
@ -1,94 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
projectName=strolch_bundle
|
|
||||||
ROOT="$(cd ${0%/*} ; pwd)"
|
|
||||||
|
|
||||||
projectVersion=$(grep -m 1 "<version>" pom.xml | tr '<>' '|' | cut -d '|' -f 3)
|
|
||||||
if [ $? != 0 ] ; then
|
|
||||||
echo "ERROR: Failed to parse version!"
|
|
||||||
fi
|
|
||||||
|
|
||||||
bundle_name="${projectName}-${projectVersion}"
|
|
||||||
workDir="${ROOT}/target/${bundle_name}"
|
|
||||||
DIST_STROLCH="/opt/www/eitch/strolch.li/dist/${projectVersion}"
|
|
||||||
DEPLOY_SERVER="hosting.eitchnet.ch"
|
|
||||||
|
|
||||||
echo "INFO: Creating bundle ${bundle_name}"
|
|
||||||
|
|
||||||
# Create all needed packages
|
|
||||||
echo "INFO: Building projects..."
|
|
||||||
if ! mvn -DskipTests clean package ; then
|
|
||||||
echo "ERROR: Failed to build packages!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Make sure the work directory exists
|
|
||||||
if [ -d "${workDir}" ] ; then
|
|
||||||
if ! rm -rf "${workDir}" ; then
|
|
||||||
echo "ERROR: Failed to clean work dir ${workDir}."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if ! mkdir -p "${workDir}" ; then
|
|
||||||
echo "ERROR: Failed to create work dir ${workDir}."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "INFO: Copying bundles..."
|
|
||||||
cd ${ROOT}
|
|
||||||
for project in ls * ; do
|
|
||||||
if [ ! -d ${project} ] ; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
if [ ${project} == "dev" ] || [ ${project} == "target" ] ; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "INFO: Copying ${project} packages..."
|
|
||||||
if ls ${project}/target/*.jar 2>/dev/null ; then
|
|
||||||
if ! cp ${project}/target/*.jar "${workDir}" ; then
|
|
||||||
echo "ERROR: Failed to copy package for project ${project}."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if ls ${project}/target/*.war 2>/dev/null ; then
|
|
||||||
if ! cp ${project}/target/*.war "${workDir}" ; then
|
|
||||||
echo "ERROR: Failed to copy wars for project ${project}."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if ls ${project}/target/*.tar.gz 2>/dev/null ; then
|
|
||||||
if ! cp ${project}/target/*.tar.gz "${workDir}" ; then
|
|
||||||
echo "ERROR: Failed to copy tarballs for project ${project}."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "INFO: Creating tarball..."
|
|
||||||
cd ${workDir}/..
|
|
||||||
if ! tar -cvzf ${bundle_name}.tar.gz ${bundle_name} ; then
|
|
||||||
echo "ERROR: Failed to make bundle."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$(hostname -f)" == "${DEPLOY_SERVER}" ] ; then
|
|
||||||
echo "INFO: Publishing..."
|
|
||||||
if ! mkdir -p ${DIST_STROLCH} ; then
|
|
||||||
echo "ERROR: Failed to create dist ${DIST_STROLCH}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if ! cp ${workDir}/* "${DIST_STROLCH}" ; then
|
|
||||||
echo "ERROR: Failed to publish packages."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! mv ${bundle_name}.tar.gz "${DIST_STROLCH}" ; then
|
|
||||||
echo "ERROR: Failed to publish bundle."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Done."
|
|
||||||
exit 0
|
|
114
release.sh
114
release.sh
|
@ -1,114 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# usage
|
|
||||||
if [ $# != 2 ] ; then
|
|
||||||
echo -e "Usage: ${0} <release_branch> <release_version>"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
releaseBranch="${1}"
|
|
||||||
newVersion="${2}"
|
|
||||||
|
|
||||||
# cleanup trap
|
|
||||||
function cleanup {
|
|
||||||
echo -e "\nINFO: Cleaning up..."
|
|
||||||
git checkout ${releaseBranch}
|
|
||||||
git checkout .
|
|
||||||
git branch -D temp
|
|
||||||
}
|
|
||||||
trap cleanup EXIT
|
|
||||||
|
|
||||||
# Confirm
|
|
||||||
echo -e "INFO: Do you want to make release version ${newVersion} from release branch ${releaseBranch}? y/n"
|
|
||||||
read a
|
|
||||||
if [[ "${a}" != "y" && "${a}" != "Y" ]] ; then
|
|
||||||
exit 0;
|
|
||||||
fi
|
|
||||||
|
|
||||||
# validate tag does not exist
|
|
||||||
echo -e "INFO: Fetching tags and branches and validating they do not exist..."
|
|
||||||
if ! git fetch --all --tags > /dev/null ; then
|
|
||||||
echo -e "ERROR: Tags and branches could not be fetched!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if git tag | grep ${newVersion} > /dev/null ; then
|
|
||||||
echo -e "ERROR: Tag already exists!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# make sure gpg-agent is available and loaded
|
|
||||||
echo -e "\nINFO: Searching for gpg-agent..."
|
|
||||||
if ! which gpg-agent ; then
|
|
||||||
echo -e "ERROR: gpg-agent missing!"
|
|
||||||
fi
|
|
||||||
if ! gpg-agent 2>&1 | grep "running and available" ; then
|
|
||||||
echo -e "WARN: gpg-agent not running, trying to start..."
|
|
||||||
if ! gpg-agent --daemon ; then
|
|
||||||
echo -e "ERROR: Failed to initialize gpg-agent, please make sure it is up and running before continuing!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if ! gpg-agent 2>&1 | grep "running and available" ; then
|
|
||||||
echo -e "ERROR: Failed to initialize gpg-agent, please make sure it is up and running before continuing!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Checkout release branch
|
|
||||||
echo -e "\nINFO: Checking out release branch ${releaseBranch}"
|
|
||||||
if ! git checkout ${releaseBranch} ; then
|
|
||||||
echo -e "ERROR: Failed to checkout branch ${releaseBranch}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# create temp branch
|
|
||||||
echo -e "\nINFO: Creating temp branch..."
|
|
||||||
if ! git checkout -b temp ; then
|
|
||||||
echo -e "ERROR: Failed to create temp branch!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# set release version
|
|
||||||
echo -e "\nINFO: Setting version..."
|
|
||||||
if ! mvn versions:set -DgenerateBackupPoms=false -DnewVersion=${newVersion} > /dev/null ; then
|
|
||||||
echo -e "ERROR: Failed to set new version!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# build
|
|
||||||
echo -e "\nINFO: Doing a build with new version..."
|
|
||||||
if ! mvn clean package -DskipTests > /dev/null ; then
|
|
||||||
echo -e "ERROR: Failed to build with new version!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# commit to tag
|
|
||||||
echo -e "\nINFO: Creating tag..."
|
|
||||||
if ! git add . ; then
|
|
||||||
echo -e "ERROR: Failed to git add"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if ! git commit -m "[Project] Set new version ${newVersion}" ; then
|
|
||||||
echo -e "ERROR: Failed to git commit"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if ! git tag --sign --message "[Project] New Version ${newVersion}" ${newVersion} ; then
|
|
||||||
echo -e "ERROR: Failed to git tag"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# local install
|
|
||||||
echo -e "\nINFO: Installing new version..."
|
|
||||||
if ! mvn source:jar install -DskipTests > /dev/null ; then
|
|
||||||
echo -e "ERROR: Failed to install new version!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# git push
|
|
||||||
if ! git push origin ${newVersion} ; then
|
|
||||||
echo -e "ERROR: Failed to push tag"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo -e "\nINFO: Pushed release tag ${newVersion}"
|
|
||||||
|
|
||||||
echo -e "\nINFO: Release ${newVersion} created."
|
|
||||||
exit 0
|
|
128
releaseBranch.sh
128
releaseBranch.sh
|
@ -1,128 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# usage
|
|
||||||
if [ $# != 2 ] ; then
|
|
||||||
echo -e "Usage: ${0} <source_branch> <version>"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
sourceBranch=${1}
|
|
||||||
releaseVersion=${2}
|
|
||||||
|
|
||||||
# cleanup trap
|
|
||||||
function cleanup {
|
|
||||||
echo -e "\nINFO: Cleaning up..."
|
|
||||||
git checkout ${sourceBranch}
|
|
||||||
git checkout .
|
|
||||||
git branch -D temp
|
|
||||||
}
|
|
||||||
trap cleanup EXIT
|
|
||||||
|
|
||||||
# Confirm
|
|
||||||
echo -e "INFO: Do you want to release version ${releaseVersion} from branch ${sourceBranch}? y/n"
|
|
||||||
read a
|
|
||||||
if [[ "${a}" != "y" && "${a}" != "Y" ]] ; then
|
|
||||||
exit 0;
|
|
||||||
fi
|
|
||||||
|
|
||||||
# validate tag and release branch do not exist
|
|
||||||
echo -e "INFO: Fetching tags and branches and validating they do not exist..."
|
|
||||||
if ! git fetch --all --tags > /dev/null ; then
|
|
||||||
echo -e "ERROR: Tags and branches could not be fetched!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if git tag | grep "${releaseVersion}" > /dev/null ; then
|
|
||||||
echo -e "ERROR: Tag already exists!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if git branch --all | grep "release/${releaseVersion}" > /dev/null ; then
|
|
||||||
echo -e "ERROR: Tag already exists!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# make sure gpg-agent is available and loaded
|
|
||||||
echo -e "\nINFO: Searching for gpg-agent..."
|
|
||||||
if ! which gpg-agent ; then
|
|
||||||
echo -e "ERROR: gpg-agent missing!"
|
|
||||||
fi
|
|
||||||
if ! gpg-agent 2>&1 | grep "running and available" ; then
|
|
||||||
echo -e "WARN: gpg-agent not running, trying to start..."
|
|
||||||
if ! gpg-agent --daemon ; then
|
|
||||||
echo -e "ERROR: Failed to initialize gpg-agent, please make sure it is up and running before continuing!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if ! gpg-agent 2>&1 | grep "running and available" ; then
|
|
||||||
echo -e "ERROR: Failed to initialize gpg-agent, please make sure it is up and running before continuing!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Checkout source branch
|
|
||||||
echo -e "\nINFO: Checking out source branch ${sourceBranch}"
|
|
||||||
if ! git checkout ${sourceBranch} ; then
|
|
||||||
echo -e "ERROR: Failed to checkout branch ${sourceBranch}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# create new release branch, and temp tag
|
|
||||||
echo -e "\nINFO: Creating release and temp branches..."
|
|
||||||
if ! git checkout -b release/${releaseVersion} ; then
|
|
||||||
echo -e "ERROR: Failed to create release branch!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if ! git checkout -b temp ; then
|
|
||||||
echo -e "ERROR: Failed to create temp branch!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# set release version
|
|
||||||
echo -e "\nINFO: Setting version..."
|
|
||||||
if ! mvn versions:set -DgenerateBackupPoms=false -DnewVersion=${releaseVersion} > /dev/null ; then
|
|
||||||
echo -e "ERROR: Failed to set new version!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# build
|
|
||||||
echo -e "\nINFO: Doing a build with new version..."
|
|
||||||
if ! mvn clean package -DskipTests > /dev/null ; then
|
|
||||||
echo -e "ERROR: Failed to build with new version!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# commit to tag
|
|
||||||
echo -e "\nINFO: Creating tag..."
|
|
||||||
if ! git add . ; then
|
|
||||||
echo -e "ERROR: Failed to git add"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if ! git commit -m "[Project] Set new version ${releaseVersion}" ; then
|
|
||||||
echo -e "ERROR: Failed to git commit"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if ! git tag --sign --message "[Project] New Version ${releaseVersion}" ${releaseVersion} ; then
|
|
||||||
echo -e "ERROR: Failed to git tag"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# local install
|
|
||||||
echo -e "\nINFO: Installing new version..."
|
|
||||||
if ! mvn source:jar install -DskipTests > /dev/null ; then
|
|
||||||
echo -e "ERROR: Failed to install new version!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# git push
|
|
||||||
echo -e "INFO: Pushing to origin..."
|
|
||||||
if ! git push origin release/${releaseVersion} ; then
|
|
||||||
echo -e "ERROR: Failed to push release branch"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if ! git push origin ${releaseVersion} ; then
|
|
||||||
echo -e "ERROR: Failed to push tag"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo -e "\nINFO: Pushed release branch and tag for release version ${releaseVersion}"
|
|
||||||
|
|
||||||
echo -e "\nINFO: Release ${releaseVersion} created."
|
|
||||||
echo -e "INFO: Don't forget to update snapshot version!"
|
|
||||||
exit 0
|
|
|
@ -1,12 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
if [ $# != 1 ] ; then
|
|
||||||
echo "Usage: ${0} <version>"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
projectVersion=${1}
|
|
||||||
|
|
||||||
mvn versions:set -DgenerateBackupPoms=false -DnewVersion=${projectVersion}
|
|
||||||
|
|
||||||
exit 0
|
|
Loading…
Reference in New Issue