• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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"
52done
53
54git archive -o "$DEST/selinux-${RELEASE_TAG}.tar.gz" --prefix="selinux-${RELEASE_TAG}/" "${RELEASE_TAG}"
55
56echo "Add the following to the $WIKIDIR/Releases.md wiki page:"
57
58echo ""
59
60echo "## Release $RELEASE_TAG"
61
62echo ""
63
64echo "[Release Notes](https://github.com/SELinuxProject/selinux/releases/download/$RELEASE_TAG/RELEASE-$RELEASE_TAG.txt)"
65echo ""
66echo "[full log](https://github.com/SELinuxProject/selinux/releases/download/$RELEASE_TAG/log-$RELEASE_TAG.txt)"
67echo ""
68echo "[short log](https://github.com/SELinuxProject/selinux/releases/download/$RELEASE_TAG/shortlog-$RELEASE_TAG.txt)"
69echo ""
70
71for COMPONENT in "${DIRS[@]}"; do
72	DIR="${COMPONENT#selinux-}"
73	VERS="$(cat "$DIR/VERSION")"
74	TAG="$COMPONENT-$VERS"
75	tarball="$TAG.tar.gz"
76	echo -n "[$tarball](https://github.com/SELinuxProject/selinux/releases/download/$RELEASE_TAG/$tarball) "
77	sha256sum "$DEST/$tarball" | cut -d " " -f 1
78	echo ""
79done
80
81echo "### Source repository snapshot"
82
83echo ""
84
85echo -n "[selinux-${RELEASE_TAG}.tar.gz](https://github.com/SELinuxProject/selinux/releases/download/$RELEASE_TAG/selinux-${RELEASE_TAG}.tar.gz) "
86sha256sum "$DEST/selinux-${RELEASE_TAG}.tar.gz" | cut -d " " -f 1
87echo ""
88
89echo "And then run:"
90echo "  cd $WIKIDIR"
91echo "  git commit  -m \"Release $RELEASE_TAG\" -a -s"
92echo "  git push"
93
94echo ""
95echo "Push the release and its tags to git via:"
96echo "  git push"
97echo "  git push --tags"
98
99echo ""
100echo "Create a new release from the latest tag on https://github.com/SELinuxProject/selinux/tags"
101
102echo ""
103echo "Add files from releases/$RELEASE_TAG as assets to the new github release"
104