Skip to content

Commit aa855af

Browse files
committed
release-git: add MSYS2 mingw-w64-git package sync
As part of the release process, we now synchronize the mingw-w64-git package to the MSYS2 upstream fork, enabling MSYS2 users to get Git for Windows via their regular package manager. This builds on the work from msys2/MINGW-packages#26470 which initially integrated the package definition into MSYS2. Since the GitForWindowsHelper GitHub App has no access to msys2/MINGW-packages, we: 1. Create an msys2-sync-<version> branch in git-artifacts.yml based on msys2/master with our mingw-w64-git/ content (commit message links to the git-artifacts workflow run for traceability) 2. Include this branch in the MINGW-packages.bundle 3. Push both main and the sync branch in repository-updates 4. Add a PR link to the release comment (separate paragraph asking the human driver to wait for repository-updates to finish first; the PR description links to the release workflow run) The PR link pre-populates the title and description, so the human driver just needs to click and submit. This is skipped for RC releases, matching the behavior of other repository updates. Assisted-by: Claude Opus 4.6 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 8dc7200 commit aa855af

File tree

3 files changed

+79
-2
lines changed

3 files changed

+79
-2
lines changed

.github/workflows/git-artifacts.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,24 @@ jobs:
317317
if test -z "$EXISTING_GIT_TAG"
318318
then
319319
git commit -s -m "mingw-w64-git: new version ($version)" PKGBUILD &&
320-
git bundle create "$b"/MINGW-packages.bundle origin/main..main
320+
321+
# Create MSYS2 sync branch: based on msys2/master with our mingw-w64-git/ content
322+
# See https://github.com/msys2/MINGW-packages/pull/26470
323+
msys2_sync_branch="msys2-sync-$version" &&
324+
git fetch --depth 1 https://github.com/msys2/MINGW-packages master &&
325+
git worktree add -b "$msys2_sync_branch" --no-checkout msys2-sync FETCH_HEAD &&
326+
git -C msys2-sync sparse-checkout set mingw-w64-git &&
327+
git -C msys2-sync checkout main -- mingw-w64-git &&
328+
git -C msys2-sync commit -m "mingw-w64-git: upgrade to Git for Windows $version
329+
330+
This commit was created by:
331+
$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID
332+
333+
See https://github.com/git-for-windows/git/releases/tag/$version for details." &&
334+
echo "::notice::Created MSYS2 sync branch $msys2_sync_branch at $(git -C msys2-sync rev-parse HEAD)" &&
335+
git worktree remove msys2-sync &&
336+
337+
git bundle create "$b"/MINGW-packages.bundle origin/main..main FETCH_HEAD.."$msys2_sync_branch"
321338
elif ! git update-index --ignore-submodules --refresh ||
322339
! git diff-files --ignore-submodules ||
323340
! git diff-index --cached --ignore-submodules HEAD

.github/workflows/release-git.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,22 @@ jobs:
140140
: `Git for Windows ${baseVersion} is available! ${releaseURL}`
141141
const blueskyLink = `https://bsky.app/intent/compose?text=${encodeURIComponent(skeet)}`
142142
143-
const body = `please [Share on Bluesky](${blueskyLink}) and send [the announcement email](${announcementURL}).`
143+
let body = `please [Share on Bluesky](${blueskyLink}) and send [the announcement email](${announcementURL}).`
144+
145+
// Add MSYS2 PR link for non-RC releases
146+
// See https://github.com/msys2/MINGW-packages/pull/26470
147+
if (!rc) {
148+
const msys2SyncBranch = `msys2-sync-${tagName}`
149+
const releaseWorkflowRunURL = `https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}`
150+
const prTitle = encodeURIComponent(`mingw-w64-git: upgrade to Git for Windows ${ver}`)
151+
const prBody = encodeURIComponent(`This PR synchronizes the \`mingw-w64-git\` package definition from [Git for Windows](https://github.com/git-for-windows/MINGW-packages/tree/main/mingw-w64-git).
152+
153+
See ${releaseURL} for the release notes.
154+
155+
This branch was pushed by ${releaseWorkflowRunURL}`)
156+
const msys2PrLink = `https://github.com/msys2/MINGW-packages/compare/master...git-for-windows:MINGW-packages:${msys2SyncBranch}?expand=1&title=${prTitle}&body=${prBody}`
157+
body += `\n\nPlease wait for the [repository-updates job](${releaseWorkflowRunURL}) to finish, then [open the MSYS2 sync PR](${msys2PrLink}).`
158+
}
144159

145160
const q = `repo:${process.env.OWNER}/${process.env.REPO}+is:pr+is:open+${gitSHA}`
146161
const { data } = await github.rest.search.issuesAndPullRequests({ q })

repository-updates.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,51 @@ const pushRepositoryUpdate = async (context, setSecret, appId, privateKey, owner
138138
'push', `https://github.com/${owner}/${repo}`, refName
139139
])
140140
context.log(`Done pushing ref ${refName} to ${owner}/${repo}`)
141+
142+
// For MINGW-packages, also push the MSYS2 sync branch from the bundle
143+
// See https://github.com/msys2/MINGW-packages/pull/26470
144+
// Note: This code only runs for non-RC releases (guarded by the action's `if` condition)
145+
if (repo === 'MINGW-packages' && bundlePath) {
146+
const fs = require('fs')
147+
const version = fs.readFileSync('bundle-artifacts/next_version').toString().trim()
148+
const msys2SyncBranch = `msys2-sync-${version}`
149+
150+
// The bundle contains a commit based on msys2/master, so we need to fetch
151+
// the prerequisite commits first. Parse the bundle header to find them
152+
// (lines starting with `-` before the first blank line).
153+
const bundleHeader = fs.readFileSync(bundlePath, 'utf-8').split('\n\n')[0]
154+
const prerequisites = bundleHeader
155+
.split('\n')
156+
.filter(line => line.startsWith('-'))
157+
.map(line => line.slice(1).split(' ')[0])
158+
159+
if (prerequisites.length > 0) {
160+
// Check which prerequisites are missing locally using cat-file --batch-check
161+
const { spawnSync } = require('child_process')
162+
const catFile = spawnSync('git', ['--git-dir', gitDir, 'cat-file', '--batch-check'], {
163+
input: prerequisites.join('\n'),
164+
encoding: 'utf-8'
165+
})
166+
const missing = catFile.stdout
167+
.split('\n')
168+
.filter(line => line.endsWith(' missing'))
169+
.map(line => line.split(' ')[0])
170+
171+
if (missing.length > 0) {
172+
context.log(`Fetching ${missing.length} prerequisite(s) from msys2/MINGW-packages`)
173+
callGit(['--git-dir', gitDir, 'fetch', '--depth', '1',
174+
'https://github.com/msys2/MINGW-packages', ...missing
175+
])
176+
}
177+
}
178+
179+
callGit(['--git-dir', gitDir, 'fetch', bundlePath, msys2SyncBranch])
180+
callGit(['--git-dir', gitDir,
181+
'-c', `http.extraHeader=${authorizationHeader}`,
182+
'push', `https://github.com/${owner}/${repo}`, `FETCH_HEAD:refs/heads/${msys2SyncBranch}`
183+
])
184+
context.log(`::notice::Pushed MSYS2 sync branch ${msys2SyncBranch} to ${owner}/${repo}`)
185+
}
141186
}
142187

143188
const pushGitBranch = async (context, setSecret, appId, privateKey, owner, repo, pushRefSpec) => {

0 commit comments

Comments
 (0)