Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d1ca5b6

Browse filesBrowse files
tony-gotargos
authored andcommitted
tools: align update-ada.sh with other scripts
PR-URL: #47044 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
1 parent aefe266 commit d1ca5b6
Copy full SHA for d1ca5b6

File tree

Expand file treeCollapse file tree

2 files changed

+26
-14
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+26
-14
lines changed
Open diff view settings
Collapse file

‎.github/workflows/tools.yml‎

Copy file name to clipboardExpand all lines: .github/workflows/tools.yml
+4-6Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,10 @@ jobs:
134134
subsystem: deps
135135
label: dependencies
136136
run: |
137-
NEW_VERSION=$(gh api repos/ada-url/ada/releases/latest -q '.tag_name|ltrimstr("v")')
138-
CURRENT_VERSION=$(grep "#define ADA_VERSION" ./deps/ada/ada.h | sed -n "s/^.*VERSION \(.*\)/\1/p")
139-
if [ "$NEW_VERSION" != "$CURRENT_VERSION" ]; then
140-
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
141-
./tools/dep_updaters/update-ada.sh "$NEW_VERSION"
142-
fi
137+
./tools/dep_updaters/update-ada.sh > temp-output
138+
cat temp-output
139+
tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
140+
rm temp-output
143141
- id: nghttp2
144142
subsystem: deps
145143
label: dependencies
Collapse file

‎tools/dep_updaters/update-ada.sh‎

Copy file name to clipboardExpand all lines: tools/dep_updaters/update-ada.sh
+22-8Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,22 @@ set -e
44

55
BASE_DIR=$(cd "$(dirname "$0")/../.." && pwd)
66
DEPS_DIR="$BASE_DIR/deps"
7-
ADA_VERSION=$1
7+
[ -z "$NODE" ] && NODE="$BASE_DIR/out/Release/node"
8+
[ -x "$NODE" ] || NODE=$(command -v node)
89

9-
if [ "$#" -le 0 ]; then
10-
echo "Error: please provide an ada version to update to"
11-
echo " e.g. $0 1.0.0"
12-
exit 1
10+
NEW_VERSION="$("$NODE" --input-type=module <<'EOF'
11+
const res = await fetch('https://api.github.com/repos/ada-url/ada/releases/latest');
12+
if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res });
13+
const { tag_name } = await res.json();
14+
console.log(tag_name.replace('v', ''));
15+
EOF
16+
)"
17+
18+
CURRENT_VERSION=$(grep "#define ADA_VERSION" "$DEPS_DIR/ada/ada.h" | sed -n "s/^.*VERSION \"\(.*\)\"/\1/p")
19+
20+
if [ "$NEW_VERSION" = "$CURRENT_VERSION" ]; then
21+
echo "Skipped because ada is on the latest version."
22+
exit 0
1323
fi
1424

1525
echo "Making temporary workspace..."
@@ -24,8 +34,8 @@ cleanup () {
2434

2535
trap cleanup INT TERM EXIT
2636

27-
ADA_REF="v$ADA_VERSION"
28-
ADA_ZIP="ada-$ADA_VERSION.zip"
37+
ADA_REF="v$NEW_VERSION"
38+
ADA_ZIP="ada-$NEW_VERSION.zip"
2939
ADA_LICENSE="LICENSE-MIT"
3040

3141
cd "$WORKSPACE"
@@ -47,5 +57,9 @@ echo ""
4757
echo "Please git add ada, commit the new version:"
4858
echo ""
4959
echo "$ git add -A deps/ada"
50-
echo "$ git commit -m \"deps: update ada to $ADA_VERSION\""
60+
echo "$ git commit -m \"deps: update ada to $NEW_VERSION\""
5161
echo ""
62+
63+
# The last line of the script should always print the new version,
64+
# as we need to add it to $GITHUB_ENV variable.
65+
echo "NEW_VERSION=$NEW_VERSION"

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.