From 109639678e62d71beac499587d95fedc3bf60bb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Sat, 5 Oct 2024 23:52:58 +0200 Subject: [PATCH] fetch latest (draft) release and unpack --- .github/scripts/fetch_release.sh | 24 ++++++++++++++++++++++++ .github/workflows/repo.yml | 3 +++ 2 files changed, 27 insertions(+) create mode 100755 .github/scripts/fetch_release.sh diff --git a/.github/scripts/fetch_release.sh b/.github/scripts/fetch_release.sh new file mode 100755 index 00000000..d2421881 --- /dev/null +++ b/.github/scripts/fetch_release.sh @@ -0,0 +1,24 @@ +#!/bin/bash +main() { + echo "Parsing the repo list" + while IFS= read -r repo; do + if release=$(curl -fqs -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${secrets.ARTIFACTS_TOKEN}" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/${repo}/releases); then + echo $release + tag="$(echo "$release" | jq -r '.[0].tag_name')" + zip_files="$(echo "$release" | jq -r '.[0].assets[] | select(.name | endswith(".zip")) | .name')" + echo "Parsing repo $repo at $tag" + if [ -n "$zip_files" ]; then + mkdir -p "firmware-$tag" + pushd "firmware-$tag" >/dev/null + while IFS= read -r zip_file || [[ -n $zip_file ]]; do + echo "Getting ZIP ${zip_file}" + wget -q "https://github.com/${repo}/releases/download/${tag}/${zip_file}" + unzip -q "$zip_file" + rm -f "$zip_file" + done < <(printf '%s' "$zip_files") + popd >/dev/null + fi + fi + done <.github/config/package_list.txt +} +main diff --git a/.github/workflows/repo.yml b/.github/workflows/repo.yml index a8836879..338d33cd 100644 --- a/.github/workflows/repo.yml +++ b/.github/workflows/repo.yml @@ -61,6 +61,9 @@ jobs: export GPG_FINGERPRINT="${{ steps.import_gpg.outputs.fingerprint }}" export ORIGIN="${{ steps.import_gpg.outputs.name }}" .github/scripts/build_repo.sh + + - name: Fetch release zips and unpack them + run: .github/scripts/fetch_release.sh - name: Upload to original repo uses: EndBug/add-and-commit@v9