Skip to content

Commit 0a9b007

Browse files
Restore stage_for_s3.bash from main branch
Co-Authored-By: Claude (global.anthropic.claude-opus-4-5-20251101-v1:0) <noreply@anthropic.com>
1 parent 599d266 commit 0a9b007

1 file changed

Lines changed: 23 additions & 22 deletions

File tree

stage_for_s3.bash

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,31 @@
11
#!/usr/bin/env bash
22

3-
set -e
4-
53
mkdir stage
64
cd stage || exit
75

86
TIMESTAMP=$(date '+%Y%m%d.%H%M')
97

108
echo "Current timestamp is $TIMESTAMP"
119

12-
# Download node tarballs from the latest release
13-
gh release download -R Asana/node -p "*.xz"
10+
gh release download -p "*.gz"
11+
gh release download -p "*.xz"
1412

15-
# Download and prepare fibers package
16-
curl "https://asana-oss-cache.s3.us-east-1.amazonaws.com/node-fibers/fibers-5.0.4.pc.tgz" --output fibers-5.0.4.tar.gz
13+
curl "https://asana-oss-cache.s3.us-east-1.amazonaws.com/node-fibers/fibers-5.0.4.pc.tgz" --output fibers-5.0.4.tar.gz
1714
tar -xzf fibers-5.0.4.tar.gz
18-
rm fibers-5.0.4.tar.gz
1915

20-
# Generate unique identifier from timestamp and hash of downloaded files
21-
SHORT_HASH=$(cat *.xz | sha1sum | cut -c1-4)
16+
find . -name "*.gz" | while read -r a
17+
do
18+
tar -xzf "$a" -C package/bin
19+
rm "$a"
20+
done
21+
22+
tar -czf temp.tgz package/
23+
rm -fr package
24+
SHORT_HASH=$(cat temp.tgz | sha1sum | cut -c1-4)
2225
echo "HASH: $SHORT_HASH"
2326
UNIQUE="pc-${TIMESTAMP}-${SHORT_HASH}"
2427

25-
# Repackage fibers with unique identifier
26-
tar -czf "fibers-5.0.4-${UNIQUE}.tgz" package/
27-
rm -rf package
28+
mv temp.tgz "fibers-5.0.4-${UNIQUE}.tgz"
2829

2930
for file in *.tar.xz; do
3031
if [[ "$file" == *-LATEST.tar.xz ]]; then
@@ -34,27 +35,23 @@ for file in *.tar.xz; do
3435
echo "Renaming: $file -> $new_name"
3536
mv "$file" "$new_name"
3637

37-
if [[ "$new_name" =~ node-v([0-9.]+)-(darwin|linux)-(arm64|x64).*\.tar\.xz$ ]]; then
38+
if [[ "$new_name" =~ node-v([0-9.]+)-(darwin|linux)-(arm64|x64)-pc.*\.tar\.xz$ ]]; then
3839
version="${BASH_REMATCH[1]}"
3940
os="${BASH_REMATCH[2]}"
4041
arch="${BASH_REMATCH[3]}"
4142
target_dir="node-v${version}-${os}-${arch}"
4243

4344
echo "Target Dir: $target_dir"
4445
mkdir "$target_dir"
45-
tar -xJf "$new_name" -C "$target_dir"
46-
47-
# Flatten directory structure if needed (handle both usr/local and direct layouts)
48-
if [ -d "$target_dir/usr/local" ]; then
49-
mv $target_dir/usr/local/* "$target_dir"
50-
rm -rf "$target_dir/usr"
51-
fi
46+
tar -xzf "$new_name" -C "$target_dir"
47+
mv "$target_dir/usr/local/*" "$target_dir"
48+
rm -fr "$target_dir/usr/local"
5249

5350
tar -cJf "$new_name" "$target_dir"
5451

55-
rm -rf "$target_dir"
52+
rm -fr "$target_dir"
5653

57-
echo "Done: Archive now contains:"
54+
echo "Done: Archive now contains:"
5855
tar -tf "$new_name" | head
5956

6057
else
@@ -63,7 +60,11 @@ for file in *.tar.xz; do
6360
fi
6461
done
6562

63+
6664
cd ..
6765
mv stage "node-${UNIQUE}"
6866

6967
echo "Files are in node-${UNIQUE}, please upload to s3"
68+
69+
70+

0 commit comments

Comments
 (0)