Skip to content

Commit

Permalink
update scripts/run-prebuilt-tdlib.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
eilvelia committed Dec 4, 2024
1 parent cd0bd50 commit 3aee94f
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions scripts/run-prebuilt-tdlib.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,34 @@
#!/usr/bin/env bash

# Requires gh, jq

version=$1
npm_patch="${2:-0}"
set -euo pipefail

if [ -z "$version" ]; then
echo "Not enough arguments: expected TDLib version"
if [ $# -lt 1 ]; then
echo "Too few arguments: expected TDLib version"
exit 1
fi

commit=$(gh search commits "Update version to $version" -R tdlib/td --json sha --jq '.[0].sha')
version=$1
npm_patch="${2:-0}"

if [ "$version" = "latest" ]; then
commit=$(gh api repos/tdlib/td/commits)
else
commit=$(gh search commits "Update version to $version" -R tdlib/td --json commit,sha)
fi

if [ -z "$commit" ]; then
if [ "$commit" = "[]" ]; then
echo "Cannot find version $version"
exit 1
fi

command="gh workflow run prebuilt-tdlib.yml --ref develop -f tdlib=$commit -f npm-patch=$npm_patch"
message=$(echo $commit | jq -r '.[0].commit.message')
sha=$(echo $commit | jq -r '.[0].sha')

command="gh workflow run prebuilt-tdlib.yml --ref develop -f tdlib=$sha -f npm-patch=$npm_patch"

echo "TDLib commit: https://github.com/tdlib/td/commit/$commit"
echo "TDLib commit: https://github.com/tdlib/td/commit/$sha"
echo "Message: \"$message\""
echo "Command: $command"
read -p "Run? (Ctrl-c or n to exit) " answer
case $answer in
Expand Down

0 comments on commit 3aee94f

Please sign in to comment.