Skip to content

Commit 6354dfd

Browse files
committed
tag-git/git-artifacts: allow tagging and building MinGit backports
In the past, I built MinGit backports by crafting tags manually, then letting an Azure Pipeline pick that tag up, automatically determine the corresponding `mingit-2.<N>.x-releases` release branch name, and then build the MinGit assets. However, with the nice `tag-git` and `git-artifacts` GitHub workflows already doing much of what is needed to streamline the process, we can easily adjust both workflows to allow ticking a `mingit-only` checkbox and use the exact same flow for MinGit backports as for embargoed Git for Windows releases: open a PR with the changes, start the `tag-git` workflow, and once it finishes, kick off corresponding `git-artifacts` workflow runs, one for each supported architecture. The main adjustment is this `mingit-only` checkbox, writing the `mingit-only` file to the `bundle-artifacts` artifact if set, and crafting slightly a different release notes/tag title than regular Git for Windows releases'. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent ea0671b commit 6354dfd

File tree

3 files changed

+30
-15
lines changed

3 files changed

+30
-15
lines changed

.github/workflows/git-artifacts.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ jobs:
186186
unzip bundle-artifacts.zip -d bundle-artifacts
187187
echo "GIT_VERSION=$(cat bundle-artifacts/next_version)" >> $GITHUB_ENV
188188
echo "GIT_REV=$(cat bundle-artifacts/git-commit-oid)" >>$GITHUB_ENV
189+
test ! -f bundle-artifacts/mingit-only || echo "GIT_OR_MINGIT=MinGit" >>$GITHUB_ENV
189190
- name: Mirror Check Run to ${{ env.OWNER }}/${{ env.REPO }}
190191
uses: ./.github/actions/check-run-action
191192
with:
@@ -241,9 +242,11 @@ jobs:
241242
echo "SDK_REPO_ARCH=$SDK_REPO_ARCH" >> $GITHUB_OUTPUT
242243
test -n "$ARTIFACTS_TO_BUILD" || {
243244
ARTIFACTS_TO_BUILD="mingit"
244-
test "$ARCHITECTURE" = i686 || ARTIFACTS_TO_BUILD="installer portable archive $ARTIFACTS_TO_BUILD"
245245
test "$ARCHITECTURE" = aarch64 || ARTIFACTS_TO_BUILD="$ARTIFACTS_TO_BUILD mingit-busybox"
246-
test "$ARCHITECTURE" != x86_64 || ARTIFACTS_TO_BUILD="$ARTIFACTS_TO_BUILD nuget"
246+
test -f bundle-artifacts/mingit-only || {
247+
test "$ARCHITECTURE" = i686 || ARTIFACTS_TO_BUILD="installer portable archive $ARTIFACTS_TO_BUILD"
248+
test "$ARCHITECTURE" != x86_64 || ARTIFACTS_TO_BUILD="$ARTIFACTS_TO_BUILD nuget"
249+
}
247250
}
248251
echo "ARTIFACTS_TO_BUILD=$ARTIFACTS_TO_BUILD" >> $GITHUB_ENV
249252
echo "PKG_CACHE_KEY=pkg-$GIT_VERSION-$ARCHITECTURE-$TAG_GIT_WORKFLOW_RUN_ID" >> $GITHUB_ENV

.github/workflows/tag-git.yml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: tag-git
2-
run-name: "Tag Git ${{ inputs.snapshot == 'true' && 'snapshot ' || '' }}at ${{ inputs.owner }}/${{ inputs.repo }}@${{ inputs.rev }}"
2+
run-name: "Tag ${{ inputs.mingit-only == 'true' && 'Min' || '' }}Git ${{ inputs.snapshot == 'true' && 'snapshot ' || '' }}at ${{ inputs.owner }}/${{ inputs.repo }}@${{ inputs.rev }}"
33

44
on:
55
workflow_dispatch:
@@ -24,6 +24,10 @@ on:
2424
description: 'A flag indicating whether this is a snapshot or a full Git for Windows release'
2525
required: true
2626
default: "true"
27+
mingit-only:
28+
description: 'A flag indicating whether this is a MinGit-only release (AKA MinGit backport)'
29+
required: false
30+
default: "false"
2731

2832
env:
2933
GPG_OPTIONS: "--batch --yes --no-tty --list-options no-show-photos --verify-options no-show-photos --pinentry-mode loopback"
@@ -32,6 +36,7 @@ env:
3236
REV: "${{github.event.inputs.rev}}"
3337
RELEASE_BRANCH: "${{github.event.inputs.release-branch}}"
3438
SNAPSHOT: "${{github.event.inputs.snapshot}}"
39+
MINGIT_ONLY: "${{github.event.inputs.mingit-only}}"
3540
CREATE_CHECK_RUN: "true"
3641
NODEJS_VERSION: 16
3742

@@ -64,8 +69,8 @@ jobs:
6469
repo: ${{ env.REPO }}
6570
rev: ${{ env.REV }}
6671
check-run-name: "tag-git"
67-
title: "Tag Git @${{ env.REV }}"
68-
summary: "Tag Git @${{ env.REV }}"
72+
title: "Tag ${{ env.MINGIT_ONLY == 'true' && 'Min' || '' }}Git @${{ env.REV }}"
73+
summary: "Tag ${{ env.MINGIT_ONLY == 'true' && 'Min' || '' }}Git @${{ env.REV }}"
6974
text: "For details, see [this run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id}})."
7075
details-url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id}}"
7176
- name: Configure user
@@ -106,9 +111,14 @@ jobs:
106111
--build-extra-dir="$RUNNER_TEMP/build-extra" \
107112
--artifacts-dir="$GITHUB_WORKSPACE/bundle-artifacts" \
108113
--release-branch="$RELEASE_BRANCH" \
114+
$(test "$MINGIT_ONLY" = 'true' && echo '--mingit') \
109115
"$REV" &&
110116
111117
echo "$RELEASE_BRANCH" >bundle-artifacts/release-branch &&
118+
if test true = "$MINGIT_ONLY"
119+
then
120+
>bundle-artifacts/mingit-only
121+
fi &&
112122
113123
echo "tag-name=$(cat bundle-artifacts/next_version)" >>$GITHUB_OUTPUT &&
114124
echo "Tag name: \`$(cat bundle-artifacts/next_version)\`" >>$GITHUB_STEP_SUMMARY
@@ -118,9 +128,9 @@ jobs:
118128
with:
119129
app-id: ${{ secrets.GH_APP_ID }}
120130
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
121-
title: "Tag Git ${{ steps.generate.outputs.tag-name }} @${{ env.REV }}"
122-
summary: "Tag Git ${{ steps.generate.outputs.tag-name }} @${{ env.REV }}"
123-
append-text: 'Tagged Git ${{ steps.generate.outputs.tag-name }}'
131+
title: "Tag ${{ env.MINGIT_ONLY == 'true' && 'Min' || '' }}Git ${{ steps.generate.outputs.tag-name }} @${{ env.REV }}"
132+
summary: "Tag ${{ env.MINGIT_ONLY == 'true' && 'Min' || '' }}Git ${{ steps.generate.outputs.tag-name }} @${{ env.REV }}"
133+
append-text: "Tagged ${{ env.MINGIT_ONLY == 'true' && 'Min' || '' }}Git ${{ steps.generate.outputs.tag-name }}"
124134
- name: 'Publish Pipeline Artifact: bundle-artifacts'
125135
uses: actions/upload-artifact@v4
126136
with:

update-scripts/tag-git.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ git_git_dir=/usr/src/git/.git &&
99
build_extra_dir=/usr/src/build-extra &&
1010
artifacts_dir= &&
1111
release_branch=main &&
12+
git_or_mingit="Git for Windows" &&
1213
snapshot_version=t &&
1314
while case "$1" in
1415
--git-dir=*) git_git_dir="${1#*=}";;
1516
--build-extra-dir=*) build_extra_dir="${1#*=}";;
1617
--artifacts-dir=*) artifacts_dir="${1#*=}";;
1718
--release-branch=*) release_branch="${1#*=}";;
19+
--mingit) git_or_mingit="MinGit for Windows";;
1820
--full|--full-version|--no-snapshot|--no-snapshot-version) snapshot_version=;;
1921
*) break;;
2022
esac; do shift; done ||
@@ -120,7 +122,7 @@ else
120122
sed -e 's/\( [2-9]\?[4-90]\| 1[0-9]\) /\1th /' \
121123
-e 's/1 /1st /' -e 's/2 /2nd /' -e 's/3 /3rd /'
122124
)" &&
123-
sed -i -e "1s/.*/# Git for Windows v$display_version Release Notes/" \
125+
sed -i -e "1s/.*/# $git_or_mingit v$display_version Release Notes/" \
124126
-e "2s/.*/Latest update: $release_date/" \
125127
"$build_extra_dir"/ReleaseNotes.md &&
126128
git -C "$build_extra_dir" commit -s \
@@ -133,7 +135,7 @@ else
133135
markdown |
134136
LC_CTYPE=C w3m -dump -cols 72 -T text/html)" &&
135137
tag_message="$(printf "%s\n\n%s" \
136-
"$(sed -n '1s/.*\(Git for Windows v[^ ]*\).*/\1/p' \
138+
"$(sed -n '1s/.* \(\(Min\)\?Git for Windows v[^ ]*\).*/\1/p' \
137139
<"$build_extra_dir"/ReleaseNotes.md)" "$notes")" &&
138140

139141
cat >"$artifacts_dir"/release-notes-$display_version <<-EOF &&
@@ -144,11 +146,11 @@ else
144146
@@CHECKSUMS@@
145147
EOF
146148

147-
case "$display_version" in
148-
prerelease-*)
149+
case "$git_or_mingit,$display_version" in
150+
*,prerelease-*)
149151
url=https://gitforwindows.org/git-snapshots/
150152
;;
151-
*-rc*)
153+
*,*-rc*|MinGit*)
152154
url=https://github.com/git-for-windows/git/releases/tag/$tag_name
153155
;;
154156
*)
@@ -160,15 +162,15 @@ else
160162
From: $(git var GIT_COMMITTER_IDENT | sed -e 's/>.*/>/')
161163
Date: $(date -R)
162164
To: git@vger.kernel.org, git-packagers@googlegroups.com
163-
Subject: [ANNOUNCE] Git for Windows $display_version
165+
Subject: [ANNOUNCE] $git_or_mingit $display_version
164166
Content-Type: text/plain; charset=UTF-8
165167
Content-Transfer-Encoding: 8bit
166168
MIME-Version: 1.0
167169
Fcc: Sent
168170
169171
Dear Git users,
170172
171-
I hereby announce that Git for Windows $display_version is available from:
173+
I hereby announce that $git_or_mingit $display_version is available from:
172174
173175
$url
174176

0 commit comments

Comments
 (0)