Skip to content

Commit 40c25e3

Browse files
committed
Add a script to target the git-snapshots releases
Previously, the Git for Windows snapshots were hosted on Azure Blobs. Now they are hosted in GitHub releases in the https://github.com/git-for-windows/git-snapshots repository. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 7458a8d commit 40c25e3

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

adjust-hrefs.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env node
2+
3+
(async () => {
4+
const fs = require('fs')
5+
const lines = fs.readFileSync('index.html', 'utf-8').split('\n')
6+
7+
let tagName
8+
for (let i = 0; i < lines.length; i++) {
9+
const match = lines[i].match(/href="(?!GitForWindows\.css|mailto:)(Git-(.*)-64-bit\.exe|[^"\/]+)"/)
10+
if (!match) continue
11+
if (match[2]) tagName = match[2]
12+
lines[i] = lines[i].replace(
13+
/href="([^"\/]+)"/g,
14+
`href="https://github.com/git-for-windows/git-snapshots/releases/download/${tagName}/$1"`
15+
)
16+
}
17+
18+
fs.writeFileSync('index.html', lines.join('\n'))
19+
})().catch(e => {
20+
console.error(e)
21+
process.exit(1)
22+
})

0 commit comments

Comments
 (0)