fix(github/update): aarch64 artifacts for resilient are referenced in source file

the problem with the previous version of the script is that the HTTP
query to get the release artifacts to download and upload in our
repository wasn't retrieving by the specified architecture, leading us
to have an output with two lines with the following order:
 1. [...x84_64]
 2. [...aarch64]

At least now it supports already uploaded artifacts so while developing
for example, you won't need to remove the artifact from the repository
to keep trying.

Secondary changes:
 - We have better logs to trace the flow that every binary had in the update script
This commit is contained in:
Luis Quiñones
2025-02-15 19:16:05 -05:00
parent 66976a3e4a
commit 23dd63e6ae

31
.github/update.sh vendored
View File

@@ -28,10 +28,13 @@ commit_twilight_targets=""
commit_twilight_version=""
get_twilight_release_from_zen_repo() {
arch=$1
curl -sL \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/zen-browser/desktop/releases/tags/twilight
https://api.github.com/repos/zen-browser/desktop/releases/tags/twilight |
jq -r --arg arch "$arch" '.assets[] | select(.name | contains("zen.linux") and contains($arch)) | "\(.id) \(.name)"'
}
download_artifact_from_zen_repo() {
@@ -98,25 +101,27 @@ try_to_update() {
echo "Release $release_name already exists, skipping creation..."
fi
get_twilight_release_from_zen_repo | jq -r '.assets[] | select(.name | contains("zen.linux")) | "\(.id) \(.name)"' |
get_twilight_release_from_zen_repo "$arch" |
while read -r line; do
artifact_id=$(echo "$line" | cut -d' ' -f1)
artifact_name=$(echo "$line" | cut -d' ' -f2)
if gh release --repo="$flake_repo_location" view "$release_name" | grep "$artifact_name" >/dev/null; then
echo "Artifact $artifact_name already exists in $release_name, skipping..."
self_download_url="https://github.com/0xc000022070/zen-browser-flake/releases/download/$release_name/zen.linux-$arch.tar.xz"
continue
if ! gh release --repo="$flake_repo_location" view "$release_name" | grep "$artifact_name" >/dev/null; then
echo "[downloading] An artifact $artifact_name doesn't exists in $release_name"
download_artifact_from_zen_repo "$artifact_id" "/tmp/$artifact_name"
gh release --repo="$flake_repo_location" \
upload "$release_name" "/tmp/$artifact_name"
echo "[uploaded] The artifact is available @ following link: $self_download_url"
else
echo "[skipping] An artifact $artifact_name already exists in $release_name @ following link: $self_download_url"
fi
download_artifact_from_zen_repo "$artifact_id" "/tmp/$artifact_name"
gh release --repo="$flake_repo_location" \
upload "$release_name" "/tmp/$artifact_name"
resilient_download_url="https://github.com/0xc000022070/zen-browser-flake/releases/download/$release_name/zen.linux-$arch.tar.xz"
jq ".[\"twilight-resilient\"][\"$arch-linux\"] = {\"version\":\"$semver\",\"sha1\":\"$remote_sha1\",\"url\":\"$resilient_download_url\",\"sha256\":\"$sha256\"}" <sources.json >sources.json.tmp
jq ".[\"twilight-resilient\"][\"$arch-linux\"] = {\"version\":\"$semver\",\"sha1\":\"$remote_sha1\",\"url\":\"$self_download_url\",\"sha256\":\"$sha256\"}" <sources.json >sources.json.tmp
mv sources.json.tmp sources.json
done
fi