1#!/bin/bash 2 3# Fail when a command fails 4set -e 5 6# Ensure the script is running from the top level directory 7cd "$(dirname -- "$0")/.." 8 9WIKIDIR=../selinux.wiki 10 11if ! [ -d "$WIKIDIR" ]; then 12 git clone git@github.com:SELinuxProject/selinux.wiki.git "$WIKIDIR" 13fi 14 15RELEASE_TAG="$(cat VERSION)" 16DEST="releases/$RELEASE_TAG" 17DIRS=( 18 checkpolicy 19 libselinux 20 libsemanage 21 libsepol 22 mcstrans 23 policycoreutils 24 restorecond 25 secilc 26 selinux-dbus 27 selinux-gui 28 selinux-python 29 selinux-sandbox 30 semodule-utils 31) 32 33if git rev-parse "$RELEASE_TAG" &> /dev/null ; then 34 echo "Warning: tag $RELEASE_TAG already exists" 35else 36 git tag -a "$RELEASE_TAG" -m "Release $RELEASE_TAG" 37fi 38 39rm -rf "$DEST" 40mkdir -p "$DEST" 41 42for COMPONENT in "${DIRS[@]}"; do 43 DIR="${COMPONENT#selinux-}" 44 VERS="$(cat "$DIR/VERSION")" 45 TAG="$COMPONENT-$VERS" 46 if git rev-parse "$TAG" &> /dev/null ; then 47 echo "Warning: tag $TAG already exists" 48 else 49 git tag "$TAG" > /dev/null 50 fi 51 git -C "$DIR" archive -o "../$DEST/$TAG.tar.gz" --prefix="$TAG/" "$TAG" 52 gpg -b -a "../$DEST/$TAG.tar.gz" 53done 54 55git archive -o "$DEST/selinux-${RELEASE_TAG}.tar.gz" --prefix="selinux-${RELEASE_TAG}/" "${RELEASE_TAG}" 56 57echo "Add the following to the $WIKIDIR/Releases.md wiki page:" 58 59echo "" 60 61echo "## Release $RELEASE_TAG" 62 63echo "" 64 65echo "[Release Notes](https://github.com/SELinuxProject/selinux/releases/download/$RELEASE_TAG/RELEASE-$RELEASE_TAG.txt)" 66echo "" 67echo "[full log](https://github.com/SELinuxProject/selinux/releases/download/$RELEASE_TAG/log-$RELEASE_TAG.txt)" 68echo "" 69echo "[short log](https://github.com/SELinuxProject/selinux/releases/download/$RELEASE_TAG/shortlog-$RELEASE_TAG.txt)" 70echo "" 71 72for COMPONENT in "${DIRS[@]}"; do 73 DIR="${COMPONENT#selinux-}" 74 VERS="$(cat "$DIR/VERSION")" 75 TAG="$COMPONENT-$VERS" 76 tarball="$TAG.tar.gz" 77 echo -n "[$tarball](https://github.com/SELinuxProject/selinux/releases/download/$RELEASE_TAG/$tarball) " 78 sha256sum "$DEST/$tarball" | cut -d " " -f 1 79 echo "" 80done 81 82echo "### Source repository snapshot" 83 84echo "" 85 86echo -n "[selinux-${RELEASE_TAG}.tar.gz](https://github.com/SELinuxProject/selinux/releases/download/$RELEASE_TAG/selinux-${RELEASE_TAG}.tar.gz) " 87sha256sum "$DEST/selinux-${RELEASE_TAG}.tar.gz" | cut -d " " -f 1 88echo "" 89 90echo "And then run:" 91echo " cd $WIKIDIR" 92echo " git commit -m \"Release $RELEASE_TAG\" -a -s" 93echo " git push" 94 95echo "" 96echo "Push the release and its tags to git via:" 97echo " git push" 98echo " git push --tags" 99 100echo "" 101echo "Create a new release from the latest tag on https://github.com/SELinuxProject/selinux/tags" 102 103echo "" 104echo "Add files from releases/$RELEASE_TAG as assets to the new github release" 105