1#!/bin/bash
2
3DEST=../selinux-$(date '+%Y%m%d')
4DIRS="libsepol libselinux libsemanage policycoreutils checkpolicy secilc sepolgen"
5
6git tag -a $(date '+%Y%m%d') -m "Release $(date '+%Y%m%d')"
7
8rm -rf $DEST
9mkdir -p $DEST
10
11for i in $DIRS; do
12	cd $i
13	VERS=`cat VERSION`
14	ARCHIVE=$i-$VERS.tar.gz
15	git tag $i-$VERS > /dev/null 2>&1
16	git archive --format=tar --prefix=$i-$VERS/ $i-$VERS | gzip > ../$DEST/$ARCHIVE
17	cd ..
18done
19
20cd $DEST
21
22echo "Copy *.tar.gz from $DEST to the server and add the following to the Releases wiki page:"
23
24echo ""
25
26echo "## Release $(date '+%Y-%m-%d')"
27
28for i in *.tar.gz; do
29
30	echo -n "[$i](https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases/$(date '+%Y%m%d')/$i) "
31	sha256sum $i | cut -d " " -f 1
32	echo ""
33done
34