| 1 | #!/bin/bash |
| 2 | |
| 3 | PWD=`pwd` |
| 4 | WIKIDIR=../selinux.wiki |
| 5 | |
| 6 | if [ \! -d $WIKIDIR ]; then |
| 7 | git clone [email protected]:SELinuxProject/selinux.wiki.git $WIKIDIR |
| 8 | fi |
| 9 | |
| 10 | RELEASE_TAG=$(date '+%Y%m%d') |
| 11 | DEST=releases/$RELEASE_TAG |
| 12 | DIRS="libsepol libselinux libsemanage checkpolicy secilc policycoreutils mcstrans restorecond semodule-utils" |
| 13 | DIRS_NEED_PREFIX="dbus gui python sandbox" |
| 14 | |
| 15 | git tag -a $RELEASE_TAG -m "Release $RELEASE_TAG" |
| 16 | |
| 17 | rm -rf $DEST |
| 18 | mkdir -p $DEST |
| 19 | |
| 20 | for i in $DIRS; do |
| 21 | cd $i |
| 22 | VERS=`cat VERSION` |
| 23 | ARCHIVE=$i-$VERS.tar.gz |
| 24 | git tag $i-$VERS > /dev/null 2>&1 |
| 25 | git archive --format=tar --prefix=$i-$VERS/ $i-$VERS | gzip > ../$DEST/$ARCHIVE |
| 26 | cd .. |
| 27 | done |
| 28 | |
| 29 | for i in $DIRS_NEED_PREFIX; do |
| 30 | cd $i |
| 31 | VERS=`cat VERSION` |
| 32 | ARCHIVE=selinux-$i-$VERS.tar.gz |
| 33 | git tag selinux-$i-$VERS > /dev/null 2>&1 |
| 34 | git archive --format=tar --prefix=selinux-$i-$VERS/ selinux-$i-$VERS | gzip > ../$DEST/$ARCHIVE |
| 35 | cd .. |
| 36 | done |
| 37 | |
| 38 | cd $DEST |
| 39 | |
| 40 | git add . |
| 41 | |
| 42 | echo "Add the following to the $WIKIDIR/Releases.md wiki page:" |
| 43 | |
| 44 | echo "" |
| 45 | |
| 46 | echo "## Release $(date '+%Y-%m-%d')" |
| 47 | |
| 48 | echo "" |
| 49 | |
| 50 | echo "[Release Notes](https://github.com/SELinuxProject/selinux/releases/download/$RELEASE_TAG/RELEASE-$RELEASE_TAG.txt)" |
| 51 | echo "" |
| 52 | echo "[full log](https://github.com/SELinuxProject/selinux/releases/download/$RELEASE_TAG/log-$RELEASE_TAG.txt)" |
| 53 | echo "" |
| 54 | echo "[short log](https://github.com/SELinuxProject/selinux/releases/download/$RELEASE_TAG/shortlog-$RELEASE_TAG.txt)" |
| 55 | echo "" |
| 56 | |
| 57 | for i in *.tar.gz; do |
| 58 | |
| 59 | echo -n "[$i](https://github.com/SELinuxProject/selinux/releases/download/$RELEASE_TAG/$i) " |
| 60 | sha256sum $i | cut -d " " -f 1 |
| 61 | echo "" |
| 62 | done |
| 63 | |
| 64 | echo "And then run:" |
| 65 | echo " cd $WIKIDIR" |
| 66 | echo " git commit -m \"Release $RELEASE_TAG\" -a -s" |
| 67 | echo " git push" |
| 68 | |
| 69 | echo "" |
| 70 | echo "Push the release and its tags to git via:" |
| 71 | echo " git push" |
| 72 | echo " git push --tags" |
| 73 | |
| 74 | echo "" |
| 75 | echo "Create a new release from the latest tag on https://github.com/SELinuxProject/selinux/tags" |
| 76 | |
| 77 | echo "" |
| 78 | echo "Add files from releases/$RELEASE_TAG as assets to the new github release" |