forked from git-for-windows/git
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a workflow to backfill the missing installers in the recent snaps…
…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
Showing
2 changed files
with
55 additions
and
293 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.