Skip to content

Commit 78eab54

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 <johannes.schindelin@gmx.de>
1 parent e6d16d4 commit 78eab54

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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+
with:
15+
script: |
16+
const makeList = require('./make-list.js')
17+
const list = makeList()
18+
19+
const ChildProcess = require('child_process')
20+
const run = (cmd, args) => {
21+
const { error, status, stderr, stdout } = ChildProcess.spawnSync(cmd, args, { stdio: 'inherit' })
22+
if (error) {
23+
throw error
24+
}
25+
if (status !== 0) {
26+
throw new Error(`${cmd} ${args.join(' ')} exited with status ${status} (stderr: ${stderr})`)
27+
}
28+
return stdout
29+
}
30+
31+
const baseURL = 'https://wingit.blob.core.windows.net/'
32+
const targets = []
33+
for (const release of list) {
34+
console.log(JSON.stringify(release, null, 2))
35+
for (name of release.names) {
36+
const target = name.replace(/.*\//, '')
37+
// call on curl to download the file
38+
run('curl', ['-sfLo', target, `${baseURL}${name}`])
39+
targets.push(target)
40+
}
41+
42+
// call GitHub CLI to upload the files to a new release
43+
run('gh', [
44+
'release',
45+
'create',
46+
'-R',
47+
'${{ github.repository }}',
48+
'--title',
49+
(new Date(release.date)).toString(),
50+
release.date,
51+
...targets])
52+
break
53+
}
54+

0 commit comments

Comments
 (0)