Skip to content

Instantly share code, notes, and snippets.

@nullivex
Last active December 15, 2015 11:18
Show Gist options
  • Save nullivex/5251500 to your computer and use it in GitHub Desktop.
Save nullivex/5251500 to your computer and use it in GitHub Desktop.
LSS Package Release Scripts
#!/bin/bash
msg=$1
commit() {
for line in $1; do
echo "Committing $line"
cd $line;
git commit -a -m "$2"
cd ..
done
}
if [ -z to_release ]; then
echo "Release file ./to_release doesnt exist; create it; one package per line"
exit
fi
if [ $(cat to_release | wc -l) -eq 0 ]; then
echo "No packages to push"
exit
fi
echo "Packages to be committed with message \"$msg\""
to_release=$(cat to_release | grep -oP "[0-9a-z\-]+$")
echo -e "$to_release"
read -r -p "Are you sure? [Y/n] " response
case $response in
[yY][eE][sS]|[yY])
commit "$to_release" "$msg"
exit
;;
*)
echo "Will not release"
exit
;;
esac
#!/bin/bash
push() {
for line in $1; do
echo "Pushing $line"
cd $line;
git push && git push --tags
cd ..
done
}
if [ -z to_release ]; then
echo "Release file ./to_release doesnt exist; create it; one package per line"
exit
fi
if [ $(cat to_release | wc -l) -eq 0 ]; then
echo "No packages to push"
exit
fi
echo "Packages to be pushed:"
to_release=$(cat to_release | grep -oP "[0-9a-z\-]+$")
echo -e "$to_release"
read -r -p "Are you sure? [Y/n] " response
case $response in
[yY][eE][sS]|[yY])
push "$to_release"
exit
;;
*)
echo "Will not release"
exit
;;
esac
#!/bin/bash
if [ -z to_release ]; then
echo "Release file ./to_release doesnt exist; create it; one package per line"
exit
fi
if [ $(cat to_release | wc -l) -eq 0 ]; then
echo "No packages to release"
exit
fi
echo "Packages to be released:"
to_release=$(cat to_release | grep -oP "[0-9a-z\-]+$")
echo -e "$to_release"
read -r -p "Are you sure? [Y/n] " response
case $response in
[yY][eE][sS]|[yY])
echo -e "$to_release" | xargs -I{} ./release_pkg.sh {}
exit
;;
*)
echo "Will not release"
exit
;;
esac
#!/bin/bash
cd $1
echo "Grabbing updates and merging"
git checkout master
git pull
git checkout 0.0.x-dev
changes=$(git rev-list --left-right --count master...HEAD | awk '{print $1'})
if [ $changes -eq 0 ]; then
echo "No changes to release"
exit
fi
git merge master
version="0.0.$(expr $(git tag | grep -oP "\d+$" | sort -n | tail -1) + 1)"
echo "New Version $version"
git tag $version
git checkout master
git push && git push --tags
echo "Done"
packagename
packagename
packagename
@nullivex
Copy link
Author

Put these scripts into your ~/lss folder where the sub folders all all packages

Example tree:

  • lss
    • func-ui
    • lib-config
    • autorelease.sh
    • release_pkg.sh
    • to_release

Then edit the "to_release" file and add 1 package name per line that will be released.

@nullivex
Copy link
Author

nullivex commented Apr 3, 2013

Added more scripts for commiting and pushing mass amounts of repos.

Also made the grep fixes for to_release better so the following works.

ls -l | grep lib > to_release
./autorelease.sh

@nullivex
Copy link
Author

nullivex commented Apr 9, 2013

Changed release package to correctly handle versions greater than 10.

Also changed it to not release when there are no changes in master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment