-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
Copy pathcheck.sh
executable file
·38 lines (32 loc) · 1.17 KB
/
check.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
set -e
# Dependencies:
# gh cli ^2.15.0 https://github.com/cli/cli/releases/tag/v2.15.0
# jq ^1.6 https://stedolan.github.io/jq/
repo=smartcontractkit/operator-ui
gitRoot="$(dirname -- "$0")/../"
cd "$gitRoot/operator_ui"
tag_file=TAG
current_tag=$(cat $tag_file)
echo "Currently pinned tag for $repo is $current_tag"
echo "Getting latest release for tag for $repo"
release=$(gh release view -R $repo --json 'tagName,body')
latest_tag=$(echo "$release" | jq -r '.tagName')
body=$(echo "$release" | jq -r '.body')
if [ "$current_tag" = "$latest_tag" ]; then
echo "Tag $current_tag is up to date."
exit 0
else
echo "Tag $current_tag is out of date, updating $tag_file file to latest version..."
echo "$latest_tag" >"$tag_file"
echo "Tag updated $current_tag -> $latest_tag"
if [ "$CI" ]; then
echo "current_tag=$current_tag" >>$GITHUB_OUTPUT
echo "latest_tag=$latest_tag" >>$GITHUB_OUTPUT
# See https://github.com/orgs/community/discussions/26288#discussioncomment-3876281
delimiter="$(openssl rand -hex 8)"
echo "body<<${delimiter}" >>"${GITHUB_OUTPUT}"
echo "$body" >>"${GITHUB_OUTPUT}"
echo "${delimiter}" >>"${GITHUB_OUTPUT}"
fi
fi