Skip to content

Commit deea85a

Browse files
committed
Add a workflow to initialize the releases
Git for Windows' Pacman repository is too opaque. Let's first mirror it to GitHub releases at https://github.com/git-for-windows/pacman-repo. The idea is to eventually switch completely to that transparent process of uploading new packages to GitHub releases in that repository. And after that, updating its x86_64, aarch64 and i686 branches (representing Git for Windows' new Pacman repository) to reflect the updated packages. Since GitHub Actions' debugging facilities are totally insufficient, let's first try this with the initial release and then stop. In the unlikely event that it works, I will then proceed to handle the remaining releases. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent e6d16d4 commit deea85a

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

Diff for: .github/workflows/initialize-releases.yml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Initialize releases
2+
3+
on: [push]
4+
5+
jobs:
6+
initialize:
7+
runs-on: ubuntu-latest
8+
permissions:
9+
contents: write
10+
steps:
11+
- uses: actions/checkout@v4
12+
- name: mirror Git for Windows' Pacman repository to GitHub releases
13+
uses: actions/github-script@v7
14+
env:
15+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16+
with:
17+
script: |
18+
const makeList = require('./make-list.js')
19+
const list = makeList()
20+
21+
const ChildProcess = require('child_process')
22+
const run = (cmd, args) => {
23+
const { error, status, stderr, stdout } = ChildProcess.spawnSync(cmd, args, { stdio: 'inherit' })
24+
if (error) {
25+
throw error
26+
}
27+
if (status !== 0) {
28+
throw new Error(`${cmd} ${args.join(' ')} exited with status ${status} (stderr: ${stderr})`)
29+
}
30+
return stdout
31+
}
32+
33+
const baseURL = 'https://wingit.blob.core.windows.net/'
34+
const targets = []
35+
for (const release of list) {
36+
console.log(JSON.stringify(release, null, 2))
37+
for (name of release.names) {
38+
const target = name.replace(/.*\//, '')
39+
console.log(`downloading ${baseURL}${name} to ${target}`)
40+
// call on curl to download the file
41+
run('curl', ['-sfLo', target, `${baseURL}${name}`])
42+
targets.push(target)
43+
}
44+
45+
console.log(`creating release ${release.date}`)
46+
// call GitHub CLI to upload the files to a new release
47+
run('gh', [
48+
'release',
49+
'create',
50+
'-R',
51+
'${{ github.repository }}',
52+
'--title',
53+
(new Date(release.date)).toString(),
54+
release.date,
55+
...targets])
56+
break
57+
}
58+

0 commit comments

Comments
 (0)