Skip to content

Commit

Permalink
fetch latest (draft) release and unpack
Browse files Browse the repository at this point in the history
  • Loading branch information
caveman99 committed Oct 5, 2024
1 parent c075150 commit 1096396
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/scripts/fetch_release.sh
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions .github/workflows/repo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1096396

Please sign in to comment.