summaryrefslogtreecommitdiff
path: root/helpers/xfce-update-news
blob: 3e3105cc2c066f74ea35c7809fd8605d87eabbf4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env bash

COMPONENT=$1
VERSION=$2
WRITE_TAG=$3
LAST_TAG=$(git describe --abbrev=0)
RELEASE_NOTES=$(xfce-get-release-notes "$LAST_TAG" silent)
TRANSLATIONS=$(xfce-get-translations "$LAST_TAG" "HEAD" silent)

if [ "$WRITE_TAG" = "WRITETAG" ]; then
    # Use release note from NEWS if possible, they may have been edited
    if [ -f "NEWS" ] && [ "$VERSION" = "$(head -n 1 NEWS)" ]; then
        sed '/^[[:space:]]*$/q' NEWS
    else
        printf '%s\n\n%s\n%s\n' $VERSION "$RELEASE_NOTES" "$TRANSLATIONS"
    fi
elif [ ! -f "NEWS" ]; then
    echo "There is no 'NEWS' file. Changelog since $VERSION:"
    printf '%s\n======\n%s\n%s\n\n%s' $VERSION "$RELEASE_NOTES" "$TRANSLATIONS"
else
    printf '%s\n======\n%s\n%s\n\n%s\n' $VERSION "$RELEASE_NOTES" "$TRANSLATIONS" "$(cat NEWS)" > NEWS
    git diff NEWS
fi