#!/bin/sh # Upload MinMicroG packages to releases error() { echo " "; echo "!!! FATAL: $1"; exit 1; } # Exit if not running on Github CI [ "$GITHUB_TOKEN" ] || exit 0; tag="$1"; name="$2"; date="$3"; # Release variables auth="Authorization: token $GITHUB_TOKEN"; ghapi="https://api.github.com/repos/$GITHUB_REPOSITORY/releases"; ghupl="https://uploads.github.com/repos/$GITHUB_REPOSITORY/releases"; id="$(curl -fs -H "$auth" "$ghapi/tags/$tag" | jq -r '.id')"; # Big if true if [ "$id" != "null" ] && [ "$id" != "" ]; then echo " "; echo "Daily release $tag exists !!!"; exit 0; elif (cd "./MinMicroG-resdl" && [ "$(git diff --staged -- system)" ]); then echo " "; echo "Committing updates to resdl tracker..."; ( cd "./MinMicroG-resdl" || error "could not cd"; git -c user.name="github-actions" -c user.email="actions@github.com" commit --amend -m "Current bins"; git push -f "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY" "+HEAD:refs/volatile/current"; ) elif [ "$GITHUB_EVENT_NAME" != "workflow_dispatch" ]; then echo " "; echo "Nothing to update !!!"; exit 0; fi; # Release time echo " "; echo "Creating release at $tag..."; commit="$(git -C "./MinMicroG-resdl" rev-parse "HEAD")"; [ "$commit" ] || error "could not get resdl commit"; str="$(cat <