Skip to content

Commit 6b20191

Browse files
committed
Add a workflow to backfill the missing installers in the recent snapshots
As I documented in git-for-windows/git-for-windows-automation#112, there was a problem with the recent snapshots in that the installers were not actually uploaded. That PR fixes it for future snapshots. This here workflow fixes it for existing snapshots. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 7ffdd11 commit 6b20191

File tree

2 files changed

+56
-293
lines changed

2 files changed

+56
-293
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Upload missing installers
2+
3+
on: [push]
4+
5+
jobs:
6+
upload-missing:
7+
runs-on: ubuntu-latest
8+
permissions:
9+
contents: write
10+
steps:
11+
- uses: actions/create-github-app-token@v1
12+
id: token
13+
with:
14+
app-id: ${{ secrets.GH_APP_ID }}
15+
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
16+
- name: backfill missing installers
17+
env:
18+
GH_TOKEN: ${{ steps.token.outputs.token }}
19+
run: |
20+
set -ex
21+
for logs_url in $(gh api \
22+
repos/git-for-windows/git-for-windows-automation/actions/workflows/upload-snapshot.yml/runs \
23+
--jq '.workflow_runs[].logs_url')
24+
do
25+
curl -Lo logs.zip "$logs_url"
26+
unzip -p logs.zip upload-snapshot/\*_download\ remaining\ artifacts.txt >log.txt
27+
test -s log.txt
28+
sed -n \
29+
's:.* "\(installer\|portable\)\(.*\)/\(Portable\)\?\(.*[^z]\)\(\.7z\)\?\(\.exe\).*:installer\2 \4\6:p' \
30+
<log.txt >potentials.txt
31+
test -s potentials.txt
32+
sort <potentials.txt >sorted.txt
33+
uniq -u <sorted.txt >list.txt
34+
35+
test -s list.txt || continue
36+
37+
tag_name="$(sed -n '1s/.* Git-\(.*\)-\(arm64\|64-bit\|32-bit\)\.exe.*/\1/p' list.txt)"
38+
39+
sed -n 's/.* \(I686\|X86_64\|AARCH64\)\(_WORKFLOW_RUN_ID\): \([0-9]*\)$/\1\2=\3/p' <log.txt >run-ids.txt
40+
test 3 = $(wc -l run-ids.txt)
41+
eval "$(tr A-Z a-z <run-ids.txt)"
42+
43+
while read asset file
44+
do
45+
arch=${asset#*-} &&
46+
eval run_id=\$${arch}_workflow_run_id &&
47+
echo "Downloading $asset from $run_id" &&
48+
gh -R git-for-windows/git-for-windows-automation run download $run_id --name "$asset" ||
49+
exit 1
50+
done <list.txt
51+
52+
files="$(cut -d ' ' -f 2 <list.txt)"
53+
54+
gh release upload -R ${{ github.repository }} --title "$date" "$tag_name" $files ||
55+
exit 1
56+
done

0 commit comments

Comments
 (0)