Created
September 30, 2020 12:31
-
-
Save hbish/26d1947cf4432175323961f2ab0d5207 to your computer and use it in GitHub Desktop.
Release Manifest
This file contains hidden or 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
#!/bin/bash | |
############# | |
# Release Manifest - @hbish | |
# | |
# Simple script to get tag and commit for a list of directories | |
# | |
# To use, create a release.manifest with the urls of the git repository you wish to bundle (one per line) | |
# execute and look for release.manifest_*version* file | |
# | |
############# | |
usage() { | |
echo -e "\nUsage: $0 --tag \"20.09\"" \ | |
"\n" \ | |
"\n\t To use, create a release.manifest with the url of the git repository you wish to bundle (one per line)" \ | |
"\n\t execute and look for release.manifest_*version* file" \ | |
"\n" \ | |
"\n\t--tag - tag to target" \ | |
"\n\t--help - prints usages" >&2 | |
exit 1 | |
} | |
MANIFEST="release.manifest" | |
while [ "$1" != "" ]; do | |
PARAM=`echo $1 | awk -F= '{print $1}'` | |
VALUE=`echo $1 | awk -F= '{print $2}'` | |
case $PARAM in | |
--tag) | |
TAG=$VALUE | |
;; | |
--help) | |
usage | |
;; | |
*) | |
echo "ERROR: unknown parameter \"$PARAM\"" | |
exit 1 | |
;; | |
esac | |
shift | |
done | |
if [ -z $TAG ]; then | |
echo "tag not supplied, exiting"; | |
exit 1 | |
fi | |
IFS=$'\n' read -d '' -r -a repos < $MANIFEST | |
for repo in "${repos[@]}"; do | |
echo `basename $repo .git` >> "${MANIFEST}_${TAG}" | |
echo `git ls-remote --tags $repo "refs/tags/$TAG"` >> "${MANIFEST}_${TAG}" | |
done |
This file contains hidden or 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
[email protected]:hbish/myrepo.git | |
[email protected]:myorg/myrepo.git |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment