Skip to content

Commit ad010e5

Browse files
committed
tag-git: allow specifying a release date
For embargoed builds, we need to specify a future date that has been agreed upon with the affected stakeholders. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 13e7056 commit ad010e5

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

.github/workflows/tag-git.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ on:
2020
description: 'The branch name to use for this release'
2121
required: false
2222
default: main
23+
release-date:
24+
description: 'Override the release date (defaults to today)'
25+
required: false
2326
snapshot:
2427
description: 'A flag indicating whether this is a snapshot or a full Git for Windows release'
2528
required: true
@@ -35,6 +38,7 @@ env:
3538
REPO: "${{github.event.inputs.repo}}"
3639
REV: "${{github.event.inputs.rev}}"
3740
RELEASE_BRANCH: "${{github.event.inputs.release-branch}}"
41+
RELEASE_DATE: "${{github.event.inputs.release-date}}"
3842
SNAPSHOT: "${{github.event.inputs.snapshot}}"
3943
MINGIT_ONLY: "${{github.event.inputs.mingit-only}}"
4044
CREATE_CHECK_RUN: "true"
@@ -134,6 +138,7 @@ jobs:
134138
--build-extra-dir="$RUNNER_TEMP/build-extra" \
135139
--artifacts-dir="$GITHUB_WORKSPACE/bundle-artifacts" \
136140
--release-branch="$RELEASE_BRANCH" \
141+
--release-date="$RELEASE_DATE" \
137142
$(test "$MINGIT_ONLY" = 'true' && echo '--mingit') \
138143
"$REV" &&
139144

update-scripts/tag-git.sh

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@ artifacts_dir= &&
1111
release_branch=main &&
1212
git_or_mingit="Git for Windows" &&
1313
snapshot_version=t &&
14+
release_date= &&
1415
while case "$1" in
1516
--git-dir=*) git_git_dir="${1#*=}";;
1617
--build-extra-dir=*) build_extra_dir="${1#*=}";;
1718
--artifacts-dir=*) artifacts_dir="${1#*=}";;
1819
--release-branch=*) release_branch="${1#*=}";;
1920
--mingit) git_or_mingit="MinGit for Windows";;
2021
--full|--full-version|--no-snapshot|--no-snapshot-version) snapshot_version=;;
22+
--release-date=*) release_date="${1#*=}";;
2123
*) break;;
2224
esac; do shift; done ||
2325
die "Could not parse command-line options: $*"
@@ -70,6 +72,9 @@ version_compare () {
7072
mkdir -p "$artifacts_dir" &&
7173
if test -n "$snapshot_version"
7274
then
75+
test -z "$release_date" ||
76+
die 'Cannot specify --release-date with --no-snapshot-version'
77+
7378
tag_name="$(git --git-dir "$git_git_dir" describe --match 'v[0-9]*' --exclude='*-[0-9]*' "$git_rev")-$(date +%Y%m%d%H%M%S)" &&
7479
tag_message="Snapshot build" &&
7580
release_note="Snapshot of $(git --git-dir "$git_git_dir" show -s --pretty='tformat:%h (%s, %ad)' --date=short "$git_rev")" &&
@@ -118,10 +123,13 @@ else
118123
ver="$(echo "${tag_name#v}" | sed -n \
119124
's/^\([0-9]*\.[0-9]*\.[0-9]*\(-rc[0-9]*\)\?\)\.windows\(\.1\|\(\.[0-9]*\)\)$/\1\4/p')" &&
120125

121-
release_date="$(LC_ALL=C date +"%B %-d %Y" |
122-
sed -e 's/\( [2-9]\?[4-90]\| 1[0-9]\) /\1th /' \
123-
-e 's/1 /1st /' -e 's/2 /2nd /' -e 's/3 /3rd /'
124-
)" &&
126+
if test -z "$release_date"
127+
then
128+
release_date="$(LC_ALL=C date +"%B %-d %Y" |
129+
sed -e 's/\( [2-9]\?[4-90]\| 1[0-9]\) /\1th /' \
130+
-e 's/1 /1st /' -e 's/2 /2nd /' -e 's/3 /3rd /'
131+
)"
132+
fi &&
125133
sed -i -e "1s/.*/# $git_or_mingit v$display_version Release Notes/" \
126134
-e "2s/.*/Latest update: $release_date/" \
127135
"$build_extra_dir"/ReleaseNotes.md &&

0 commit comments

Comments
 (0)