Skip to content

Commit

Permalink
Add a workflow to backfill the missing installers in the recent snaps…
Browse files Browse the repository at this point in the history
…hots

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]>
  • Loading branch information
dscho committed Feb 11, 2025
1 parent 7ffdd11 commit 7e93475
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 293 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/fix-recent-snapshots.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Upload missing installers

on: [push]

jobs:
upload-missing:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/create-github-app-token@v1
id: token
with:
app-id: ${{ secrets.GH_APP_ID }}
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
- name: mirror a snapshot
env:
GH_TOKEN: ${{ steps.token.outputs.token }}
run: |
set -ex
for logs_url in $(gh api \
repos/git-for-windows/git-for-windows-automation/actions/workflows/upload-snapshot.yml/runs \
--jq '.workflow_runs[].logs_url')
do
curl -Lo logs.zip "$logs_url"
unzip -p logs.zip upload-snapshot/\*_download\ remaining\ artifacts.txt >log.txt
test -s log.txt
sed -n \
's:.* "\(installer\|portable\)\(.*\)/\(Portable\)\?\(.*[^z]\)\(\.7z\)\?\(\.exe\).*:installer\2 \4\6:p' \
<log.txt >potentials.txt
test -s potentials.txt
sort <potentials.txt >sorted.txt
uniq -u <sorted.txt >list.txt
test -s list.txt || continue
tag_name="$(sed -n '1s/.* Git-\(.*\)-\(arm64\|64-bit\|32-bit\)\.exe.*/\1/p' list.txt)"
sed -n 's/.* \(I686\|X86_64\|AARCH64\)\(_WORKFLOW_RUN_ID\): \([0-9]*\)$/\1\2=\3/p' <log.txt >run-ids.txt
test 3 = $(wc -l run-ids.txt)
eval "$(tr A-Z a-z <run-ids.txt)"
while read asset file
do
arch=${asset#*-} &&
eval run_id=\$${arch}_workflow_run_id &&
echo "Downloading $asset from $run_id" &&
gh -R git-for-windows/git-for-windows-automation run download $run_id --name "$asset" ||
exit 1
done <list.txt
files="$(cut -d ' ' -f 2 <list.txt)"
gh release upload -R ${{ github.repository }} --title "$date" "$tag_name" $files ||
done
Loading

0 comments on commit 7e93475

Please sign in to comment.