Skip to content

Commit f7a7e36

Browse files
legendecasaduh95
authored andcommitted
tools: add temporal updater
PR-URL: #60828 Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il> Reviewed-By: LiviaMedeiros <livia@cirno.name>
1 parent a88bffe commit f7a7e36

File tree

2 files changed

+79
-0
lines changed

2 files changed

+79
-0
lines changed

.github/workflows/tools.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ on:
3737
- root-certificates
3838
- simdjson
3939
- sqlite
40+
- temporal
4041
- undici
4142
- uvwasi
4243
- zlib
@@ -243,6 +244,14 @@ jobs:
243244
cat temp-output
244245
tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
245246
rm temp-output
247+
- id: temporal
248+
subsystem: deps
249+
label: dependencies
250+
run: |
251+
./tools/dep_updaters/update-temporal.sh > temp-output
252+
cat temp-output
253+
tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
254+
rm temp-output
246255
- id: undici
247256
subsystem: deps
248257
label: dependencies
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#!/bin/sh
2+
set -e
3+
# Shell script to update temporal in the source tree to specific version
4+
5+
BASE_DIR=$(cd "$(dirname "$0")/../.." && pwd)
6+
7+
[ -z "$NODE" ] && NODE="$BASE_DIR/out/Release/node"
8+
[ -x "$NODE" ] || NODE=$(command -v node)
9+
10+
# shellcheck disable=SC1091
11+
. "$BASE_DIR/tools/dep_updaters/utils.sh"
12+
13+
NEW_VERSION="$("$NODE" --input-type=module <<'EOF'
14+
const res = await fetch('https://api.github.com/repos/boa-dev/temporal/releases/latest');
15+
if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res });
16+
const { tag_name } = await res.json();
17+
console.log(tag_name.replace('v', ''));
18+
EOF
19+
)"
20+
21+
CURRENT_VERSION=$(grep -m 1 version ./deps/temporal/Cargo.toml | tr -s ' ' | tr -d '"' | tr -d "'" | cut -d' ' -f3)
22+
23+
# This function exit with 0 if new version and current version are the same
24+
compare_dependency_version "temporal" "$NEW_VERSION" "$CURRENT_VERSION"
25+
26+
echo "Making temporary workspace"
27+
28+
WORKSPACE=$(mktemp -d 2> /dev/null || mktemp -d -t 'tmp')
29+
30+
cleanup () {
31+
EXIT_CODE=$?
32+
[ -d "$WORKSPACE" ] && rm -rf "$WORKSPACE"
33+
exit $EXIT_CODE
34+
}
35+
36+
trap cleanup INT TERM EXIT
37+
38+
TEMPORAL_TARBALL="$NEW_VERSION.tar.gz"
39+
40+
cd "$WORKSPACE"
41+
42+
curl -sL -o "$TEMPORAL_TARBALL" "https://github.com/boa-dev/temporal/archive/refs/tags/v$NEW_VERSION.tar.gz"
43+
log_and_verify_sha256sum "temporal" "$TEMPORAL_TARBALL"
44+
45+
gzip -dc "$TEMPORAL_TARBALL" | tar xf -
46+
47+
rm "$TEMPORAL_TARBALL"
48+
49+
mv "temporal-$NEW_VERSION" temporal
50+
51+
rm -rf "$WORKSPACE/temporal/.github"
52+
53+
echo "Copying existing gyp files"
54+
cp "$BASE_DIR/deps/temporal/temporal_capi/temporal_capi.gyp" "$WORKSPACE/temporal/temporal_capi"
55+
56+
echo "Applying dependency update"
57+
rm -rf "$BASE_DIR/deps/temporal"
58+
mv "$WORKSPACE/temporal" "$BASE_DIR/deps/temporal"
59+
60+
echo "All done!"
61+
echo ""
62+
echo "Please git add temporal and commit the new version:"
63+
echo ""
64+
echo "$ git add -A deps/temporal"
65+
echo "$ git commit -m \"deps: update temporal to $NEW_VERSION\""
66+
echo ""
67+
68+
# The last line of the script should always print the new version,
69+
# as we need to add it to $GITHUB_ENV variable.
70+
echo "NEW_VERSION=$NEW_VERSION"

0 commit comments

Comments
 (0)