Skip to content

Commit

Permalink
Cope with funky out-of-band releases' file naming scheme
Browse files Browse the repository at this point in the history
Regular Git for Windows releases are based on upstream Git releases, and
follow the version number pattern 2.MAJOR.MINOR.

For Git for Windows releases that are _not_ based on upstream Git
releases ("out-of-band releases"), a number is appended in parentheses,
starting with the number 2.

The intention was to write corresponding `announcement` and
`release-notes` files using a more file-system-friendly pattern that
simply appends a dot and that number. This is what the `release-git`
workflow expects.

However, in the first out-of-band release since switching Git for
Windows' release automation from Azure Pipelines to GitHub workflows,
it occurs that the announcement and release note files' names are
written unexpectedly with parentheses.

Let's just apply Postel's Law here and just rename those files to the
expected kind of file names.

Signed-off-by: Johannes Schindelin <[email protected]>
  • Loading branch information
dscho committed Jul 7, 2023
1 parent 65a23e2 commit e9e4885
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions github-release.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,18 @@ const downloadBundleArtifacts = async (context, token, owner, repo, git_artifact

fs.writeFileSync('bundle-artifacts/sha256sums', checksums)

// Work around out-of-band versions' announcement file containing parentheses
const withParens = result.ver.replace(/^(\d+\.\d+\.\d+)\.(\d+)$/, '$1($2)')
console.log(`withParens: ${withParens}`)
if (result.ver !== withParens) {
if (!fs.existsSync(`bundle-artifacts/announce-${result.ver}`)) {
fs.renameSync(`bundle-artifacts/announce-${withParens}`, `bundle-artifacts/announce-${result.ver}`)
}
if (!fs.existsSync(`bundle-artifacts/release-notes-${result.ver}`)) {
fs.renameSync(`bundle-artifacts/release-notes-${withParens}`, `bundle-artifacts/release-notes-${result.ver}`)
}
}

result.announcement = fs
.readFileSync(`bundle-artifacts/announce-${result.ver}`)
.toString()
Expand Down

0 comments on commit e9e4885

Please sign in to comment.