summaryrefslogtreecommitdiff
path: root/.github/changelog.sh
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2020-12-12 16:32:05 +0100
committerPatric Stout <github@truebrain.nl>2020-12-19 18:26:29 +0100
commit7ea5904395c6f04a256e71a1dd4708518b604d8d (patch)
tree080e49368d954c868b482eae5f8de3d55d452a36 /.github/changelog.sh
parent2df182748c8470be9b73ee45ec8acd185985fbde (diff)
downloadopenttd-7ea5904395c6f04a256e71a1dd4708518b604d8d.tar.xz
Add: [Actions] release workflow for both releases and nightlies
This has several ways of being triggered: - When creating a new release via the GitHub interface. Fully automated that will produce new binaries, upload them, and it will even update the website to tell about the new version. - When triggered in an automated way from OpenTTD/workflows to start a nightly. - Manually via the Release workflow, which accepts branches, Pull Requests and tags to build. Rerunning a job is safe and should be without issues. Everything retriggers and updates what-ever might have been broken. In fact, except for dates, it should produce identical results. Co-authored-by: Charles Pigott <charlespigott@googlemail.com>
Diffstat (limited to '.github/changelog.sh')
-rwxr-xr-x.github/changelog.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/.github/changelog.sh b/.github/changelog.sh
new file mode 100755
index 000000000..ea0da948c
--- /dev/null
+++ b/.github/changelog.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+tag=$(git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null | sed 's@\^0$@@')
+
+# If we are a tag, show the part of the changelog till (but excluding) the last stable
+if [ -n "$tag" ]; then
+ grep='^[0-9]\+\.[0-9]\+\.[0-9]\+[^-]'
+ next=$(cat changelog.txt | grep '^[0-9]' | awk 'BEGIN { show="false" } // { if (show=="true") print $0; if ($1=="'$tag'") show="true"} ' | grep "$grep" | head -n1 | sed 's/ .*//')
+ cat changelog.txt | awk 'BEGIN { show="false" } /^[0-9]+.[0-9]+.[0-9]+/ { if ($1=="'$next'") show="false"; if ($1=="'$tag'") show="true";} // { if (show=="true") print $0 }'
+ exit 0
+fi
+
+# In all other cases, show the git log of the last 7 days
+revdate=$(git log -1 --pretty=format:"%ci")
+last_week=$(date -d "$revdate -7days" +"%Y-%m-%d %H:%M")
+git log --after="${last_week}" --pretty=fuller