Created
August 15, 2023 05:51
-
-
Save sarcasticadmin/463eaf5bfb29955f6d335481a869f692 to your computer and use it in GitHub Desktop.
uronode-tarball2git
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
set -e | |
set -o pipefail | |
VERSION=$1 | |
# Location of all tarballs | |
TARBALL="/home/rherna/backups/srcs/uronode-${VERSION}.tar*" | |
# Get the oldest file in the tarball and well assume thats the time for the release | |
VERSION_DATE="$(tar tvf $TARBALL | sort -k 4 | tail -n 1 | tr -s '[:blank:]' | cut -d ' ' -f 4)T00:00:00+00:00" | |
export GIT_COMMITTER_NAME="n1uro" | |
export GIT_COMMITTER_EMAIL="[email protected]" | |
export GIT_COMMITTER_DATE=$VERSION_DATE | |
export GIT_AUTHOR_NAME="n1uro" | |
export GIT_AUTHOR_EMAIL="[email protected]" | |
export GIT_AUTHOR_DATE="$VERSION_DATE" | |
# Remove all existing files before dumping in the archive | |
(git log | cat) && git rm -r . | |
tar xvf $TARBALL --strip-components=1 | |
# Differences per version | |
case $VERSION in | |
"2.2.1" | "2.15") | |
MATCH_VERSION="${VERSION}" | |
;; | |
*) | |
MATCH_VERSION="v${VERSION}" | |
;; | |
esac | |
# Opting to omit this since it breaks the Makefile | |
# There were gz's for man pages in one release | |
#case $VERSION in | |
# "2.0" | "2.1" | "2.2.1" | "2.2" | "2.3.1") | |
# pushd ./man | |
# gunzip -f -d ./*.gz | |
# popd | |
# ;; | |
#esac | |
git add -A . | |
# Make sure we escape the dots between the version numbers | |
MATCH_VERSION=$(echo $MATCH_VERSION | sed 's/\./\\./g') | |
#cat CHANGES* | sed -ne "/${MATCH_VERSION}/,$ p" | git commit --author="n1uro <[email protected]>" --date="${VERSION_DATE}" -F - | |
RELEASE_NOTES=$(cat CHANGES* | sed -ne "/${MATCH_VERSION}/,$ p") | |
echo "$RELEASE_NOTES" | git commit -F - | |
echo "$RELEASE_NOTES" | git tag -a -F - $VERSION |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment