2121 existing_git_tag :
2222 description : ' Existing tag to build from. Requires tag_git_workflow_run_id to be empty'
2323 required : false
24- build_extra_rev_for_existing_git_tag :
25- description : ' build-extra revision to use if building from an existing Git tag. Required if existing_git_tag is non-empty '
24+ release_branch :
25+ description : ' The branch name to use for this release (e.g. `git-2.44.x-releases`) '
2626 required : false
27+ type : string
2728
2829env :
2930 GPG_OPTIONS : " --batch --yes --no-tty --list-options no-show-photos --verify-options no-show-photos --pinentry-mode loopback"
3536 REPO : git
3637 TAG_GIT_WORKFLOW_RUN_ID : " ${{github.event.inputs.tag_git_workflow_run_id}}"
3738 EXISTING_GIT_TAG : " ${{github.event.inputs.existing_git_tag}}"
38- BUILD_EXTRA_REV_FOR_EXISTING_GIT_TAG : " ${{github.event.inputs.build_extra_rev_for_existing_git_tag }}"
39+ RELEASE_BRANCH : " ${{github.event.inputs.release_branch }}"
3940
4041defaults :
4142 run :
@@ -51,10 +52,12 @@ jobs:
5152 mingw_package_prefix : ${{steps.configure-environment.outputs.MINGW_PACKAGE_PREFIX}}
5253 sdk_repo_arch : ${{steps.configure-environment.outputs.SDK_REPO_ARCH}}
5354 check-run-state : ${{steps.check-run-state.outputs.check-run-state}}
55+ release-branch : ${{steps.configure-environment.outputs.release-branch}}
5456 steps :
5557 - name : clone git-for-windows-automation
5658 uses : actions/checkout@v5
5759 - name : Construct bundle-artifacts from existing tag
60+ id : handle-existing-git-tag
5861 if : env.EXISTING_GIT_TAG != ''
5962 run : |
6063 die () {
6568 test -z "$TAG_GIT_WORKFLOW_RUN_ID" ||
6669 die 'existing_git_tag cannot be used with tag_git_workflow_run_id!'
6770
68- test -n "$BUILD_EXTRA_REV_FOR_EXISTING_GIT_TAG" ||
69- die 'existing_git_tag needs build_extra_rev_for_existing_git_tag!'
71+ if test -n "$RELEASE_BRANCH"
72+ then
73+ RELEASE_BRANCH="${EXISTING_GIT_TAG%%.windows.*}" &&
74+ RELEASE_BRANCH=git-"${RELEASE_BRANCH#v}" &&
75+ test git- != "$RELEASE_BRANCH" ||
76+ die "Could not determine release branch from '$EXISTING_GIT_TAG'"
77+ echo "RELEASE_BRANCH=$RELEASE_BRANCH" >>$GITHUB_ENV
78+ fi
7079
7180 set -o pipefail &&
7281
98107 id : get-bundle-artifacts-url
99108 with :
100109 script : |
101- if (process.env.EXISTING_GIT_TAG || process.env.BUILD_EXTRA_REV_FOR_EXISTING_GIT_TAG ) {
102- throw new Error('tag_git_workflow_run_id cannot be used with existing_git_tag or build_extra_rev_for_existing_git_tag !')
110+ if (process.env.EXISTING_GIT_TAG) {
111+ throw new Error('tag_git_workflow_run_id cannot be used with existing_git_tag!')
103112 }
104113 const getDownloadURL = require('./get-workflow-run-artifact')
105114 const workflowRunId = process.env.TAG_GIT_WORKFLOW_RUN_ID
@@ -167,6 +176,7 @@ jobs:
167176 echo "MINGW_PREFIX=$MINGW_PREFIX" >> $GITHUB_OUTPUT
168177 echo "MINGW_PACKAGE_PREFIX=$MINGW_PACKAGE_PREFIX" >> $GITHUB_ENV
169178 echo "MINGW_PACKAGE_PREFIX=$MINGW_PACKAGE_PREFIX" >> $GITHUB_OUTPUT
179+ echo "SDK_REPO_ARCH=$SDK_REPO_ARCH" >> $GITHUB_ENV
170180 echo "SDK_REPO_ARCH=$SDK_REPO_ARCH" >> $GITHUB_OUTPUT
171181 test -n "$ARTIFACTS_TO_BUILD" || {
172182 ARTIFACTS_TO_BUILD="mingit"
@@ -176,6 +186,18 @@ jobs:
176186 }
177187 echo "ARTIFACTS_TO_BUILD=$ARTIFACTS_TO_BUILD" >> $GITHUB_ENV
178188 echo "PKG_CACHE_KEY=pkg-$GIT_VERSION-$ARCHITECTURE-$TAG_GIT_WORKFLOW_RUN_ID" >> $GITHUB_ENV
189+
190+ if test -z "$RELEASE_BRANCH"
191+ then
192+ RELEASE_BRANCH="$(cat bundle-artifacts/release-branch)"
193+ if test -z "$RELEASE_BRANCH"
194+ then
195+ echo "No release branch found in bundle-artifacts/release-branch"
196+ exit 1
197+ fi
198+ echo "RELEASE_BRANCH=$RELEASE_BRANCH" >> $GITHUB_ENV
199+ fi
200+ echo "release-branch=$RELEASE_BRANCH" >> $GITHUB_OUTPUT
179201 - name : Configure user
180202 run :
181203 USER_NAME="${{github.actor}}" &&
@@ -185,9 +207,21 @@ jobs:
185207 git config --global user.email "$USER_EMAIL" &&
186208 echo "PACKAGER=$USER_NAME <$USER_EMAIL>" >> $GITHUB_ENV
187209 - uses : git-for-windows/setup-git-for-windows-sdk@v1
210+ if : env.OWNER == 'git-for-windows' && env.RELEASE_BRANCH == 'main'
188211 with :
189212 flavor : build-installers
190213 architecture : ${{env.architecture}}
214+ - name : Set up Git for Windows SDK ${{ env.architecture }} (${{ env.RELEASE_BRANCH }})
215+ if : env.OWNER != 'git-for-windows' || env.RELEASE_BRANCH != 'main'
216+ shell : bash
217+ run : |
218+ git -c checkout.workers=56 \
219+ clone --single-branch -b "$RELEASE_BRANCH" --depth 1 \
220+ https://github.com/git-for-windows/git-sdk-$SDK_REPO_ARCH D:/git-sdk-$SDK_REPO_ARCH &&
221+
222+ cygpath -aw D:/git-sdk-$SDK_REPO_ARCH/usr/bin/core_perl >>$GITHUB_PATH &&
223+ cygpath -aw D:/git-sdk-$SDK_REPO_ARCH/usr/bin >>$GITHUB_PATH &&
224+ cygpath -aw D:/git-sdk-$SDK_REPO_ARCH/${MSYSTEM,,?}/bin >>$GITHUB_PATH
191225 - name : Create artifact build matrix
192226 uses : actions/github-script@v8
193227 id : artifact-build-matrix
@@ -214,25 +248,22 @@ jobs:
214248 d=/usr/src/build-extra &&
215249 if test ! -d $d/.git
216250 then
217- git clone --single-branch -b main https://github.com/git-for-windows/build-extra $d
251+ git clone --single-branch -b "$RELEASE_BRANCH" https://github.com/git-for-windows/build-extra $d
218252 else
219- git -C $d fetch https://github.com/git-for-windows/build-extra main &&
220- git -C $d switch -C main FETCH_HEAD
253+ git -C $d fetch https://github.com/git-for-windows/build-extra "$RELEASE_BRANCH" &&
254+ git -C $d switch -C "$RELEASE_BRANCH" FETCH_HEAD
221255 fi &&
222- if test -z "$BUILD_EXTRA_REV_FOR_EXISTING_GIT_TAG "
256+ if test -z "$EXISTING_GIT_TAG "
223257 then
224- git -C $d -c pull.rebase=false pull "$PWD"/bundle-artifacts/build-extra.bundle main
225- else
226- git -C $d fetch origin "$BUILD_EXTRA_REV_FOR_EXISTING_GIT_TAG" &&
227- git -C $d reset --hard "$BUILD_EXTRA_REV_FOR_EXISTING_GIT_TAG"
258+ git -C $d -c pull.rebase=false pull "$PWD"/bundle-artifacts/build-extra.bundle "$RELEASE_BRANCH"
228259 fi
229260 - name : Prepare git-for-windows/git clone with the tag
230261 if : steps.restore-cached-git-pkg.outputs.cache-hit != 'true'
231262 run : |
232263 set -x
233264 if test ! -d /usr/src/MINGW-packages
234265 then
235- git clone --depth 1 --single-branch -b main \
266+ git clone --depth 1 --single-branch -b "$RELEASE_BRANCH" \
236267 https://github.com/git-for-windows/MINGW-packages /usr/src/MINGW-packages
237268 fi &&
238269 cd /usr/src/MINGW-packages/mingw-w64-git &&
@@ -317,15 +348,17 @@ jobs:
317348 if test -z "$EXISTING_GIT_TAG"
318349 then
319350 git commit -s -m "mingw-w64-git: new version ($version)" PKGBUILD &&
320- git bundle create "$b"/MINGW-packages.bundle origin/main..main
351+ git bundle create "$b"/MINGW-packages.bundle \
352+ "origin/$RELEASE_BRANCH..$RELEASE_BRANCH"
321353 elif ! git update-index --ignore-submodules --refresh ||
322354 ! git diff-files --ignore-submodules ||
323355 ! git diff-index --cached --ignore-submodules HEAD
324356 then
325357 echo "::warning::Uncommitted changes after build!" >&2 &&
326358 git diff >&2 &&
327359 git commit -s -m "mingw-w64-git: new version ($version)" PKGBUILD &&
328- git bundle create "$b"/MINGW-packages.bundle main^..main
360+ git bundle create "$b"/MINGW-packages.bundle \
361+ "$RELEASE_BRANCH^..$RELEASE_BRANCH"
329362 fi)
330363 - name : Cache ${{env.MINGW_PACKAGE_PREFIX}}-git
331364 if : steps.restore-cached-git-pkg.outputs.cache-hit != 'true'
@@ -364,6 +397,7 @@ jobs:
364397 MINGW_PREFIX : ${{ needs.pkg.outputs.mingw-prefix }}
365398 MINGW_PACKAGE_PREFIX : ${{ needs.pkg.outputs.mingw_package_prefix }}
366399 SDK_REPO_ARCH : ${{ needs.pkg.outputs.sdk_repo_arch }}
400+ RELEASE_BRANCH : ${{ needs.pkg.outputs.release-branch }}
367401 strategy :
368402 fail-fast : false
369403 matrix : ${{ fromJSON(needs.pkg.outputs.artifact_matrix) }}
@@ -389,9 +423,21 @@ jobs:
389423 name : bundle-artifacts
390424 path : bundle-artifacts
391425 - uses : git-for-windows/setup-git-for-windows-sdk@v1
426+ if : env.OWNER == 'git-for-windows' && env.RELEASE_BRANCH == 'main'
392427 with :
393428 flavor : build-installers
394429 architecture : ${{env.ARCHITECTURE}}
430+ - name : Set up Git for Windows SDK ${{ env.architecture }} (${{ env.RELEASE_BRANCH }})
431+ if : env.OWNER != 'git-for-windows' || env.RELEASE_BRANCH != 'main'
432+ shell : bash
433+ run : |
434+ git -c checkout.workers=56 \
435+ clone --single-branch -b "$RELEASE_BRANCH" --depth 1 \
436+ https://github.com/git-for-windows/git-sdk-$SDK_REPO_ARCH D:/git-sdk-$SDK_REPO_ARCH &&
437+
438+ cygpath -aw D:/git-sdk-$SDK_REPO_ARCH/usr/bin/core_perl >>$GITHUB_PATH &&
439+ cygpath -aw D:/git-sdk-$SDK_REPO_ARCH/usr/bin >>$GITHUB_PATH &&
440+ cygpath -aw D:/git-sdk-$SDK_REPO_ARCH/${MSYSTEM,,?}/bin >>$GITHUB_PATH
395441 - name : Configure user
396442 run :
397443 USER_NAME="${{github.actor}}" &&
@@ -405,18 +451,15 @@ jobs:
405451 d=/usr/src/build-extra &&
406452 if test ! -d $d/.git
407453 then
408- git clone --single-branch -b main https://github.com/git-for-windows/build-extra $d
454+ git clone --single-branch -b "$RELEASE_BRANCH" https://github.com/git-for-windows/build-extra $d
409455 else
410- git -C $d fetch https://github.com/git-for-windows/build-extra main &&
411- git -C $d switch -C main FETCH_HEAD
456+ git -C $d fetch https://github.com/git-for-windows/build-extra "$RELEASE_BRANCH" &&
457+ git -C $d switch -C "$RELEASE_BRANCH" FETCH_HEAD
412458 fi &&
413459 echo "result=$(cygpath -am "$d")" >> $GITHUB_OUTPUT &&
414- if test -z "$BUILD_EXTRA_REV_FOR_EXISTING_GIT_TAG "
460+ if test -z "$EXISTING_GIT_TAG "
415461 then
416- git -C $d -c pull.rebase=false pull "$PWD"/bundle-artifacts/build-extra.bundle main
417- else
418- git -C $d fetch origin "$BUILD_EXTRA_REV_FOR_EXISTING_GIT_TAG" &&
419- git -C $d reset --hard "$BUILD_EXTRA_REV_FOR_EXISTING_GIT_TAG"
462+ git -C $d -c pull.rebase=false pull "$PWD"/bundle-artifacts/build-extra.bundle "$RELEASE_BRANCH"
420463 fi
421464 - name : Prepare home directory for code-signing
422465 env :
0 commit comments