Skip to content

Commit 4bc7fb5

Browse files
committed
sync release gzip
1 parent 38a3e86 commit 4bc7fb5

File tree

1 file changed

+48
-50
lines changed

1 file changed

+48
-50
lines changed

.github/workflows/sync-extension.yml

Lines changed: 48 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -58,71 +58,69 @@ jobs:
5858
run: |
5959
TAG="${{ steps.release.outputs.tag }}"
6060
REPO="${{ secrets.SENTIENCE_CHROME_REPO }}"
61-
62-
# Download release assets
61+
62+
# Download extension-files.tar.gz from release
6363
mkdir -p extension-temp
6464
cd extension-temp
65-
66-
# Download individual files from release (reliable method - no zip)
67-
echo "📁 Downloading individual files from release..."
68-
echo "Available release assets:"
69-
curl -s -H "Authorization: token ${{ secrets.SENTIENCE_CHROME_TOKEN }}" \
65+
66+
echo "📁 Downloading extension-files.tar.gz from release..."
67+
68+
# Get the download URL for extension-files.tar.gz
69+
TARBALL_URL=$(curl -s -H "Authorization: token ${{ secrets.SENTIENCE_CHROME_TOKEN }}" \
7070
"https://api.github.com/repos/$REPO/releases/tags/$TAG" | \
71-
jq -r '.assets[] | select(.name | endswith(".js") or endswith(".wasm") or endswith(".json") or endswith(".d.ts")) | .name' || true
72-
71+
jq -r '.assets[] | select(.name=="extension-files.tar.gz") | .browser_download_url')
72+
73+
if [ -z "$TARBALL_URL" ] || [ "$TARBALL_URL" == "null" ]; then
74+
echo "❌ extension-files.tar.gz not found in release assets"
75+
echo "Available assets:"
76+
curl -s -H "Authorization: token ${{ secrets.SENTIENCE_CHROME_TOKEN }}" \
77+
"https://api.github.com/repos/$REPO/releases/tags/$TAG" | \
78+
jq -r '.assets[].name'
79+
exit 1
80+
fi
81+
82+
echo " Downloading from: $TARBALL_URL"
7383
curl -L -H "Authorization: token ${{ secrets.SENTIENCE_CHROME_TOKEN }}" \
74-
"https://api.github.com/repos/$REPO/releases/tags/$TAG" | \
75-
jq -r '.assets[] | select(.name | endswith(".js") or endswith(".wasm") or endswith(".json") or endswith(".d.ts")) | "\(.browser_download_url)|\(.name)"' | \
76-
while IFS='|' read -r url name; do
77-
if [ -n "$url" ] && [ "$url" != "null" ] && [ -n "$name" ]; then
78-
# Handle asset names that might have paths like "pkg/sentience_core.js" or "extension-package/manifest.json"
79-
# GitHub releases might preserve directory structure in asset names
80-
# Strip "extension-package/" prefix if present, as we'll handle it in copy step
81-
if [[ "$name" == extension-package/* ]]; then
82-
# Asset name is "extension-package/manifest.json" - strip prefix
83-
filename="${name#extension-package/}"
84-
dir=$(dirname "$filename")
85-
if [ "$dir" != "." ]; then
86-
mkdir -p "$dir"
87-
fi
88-
echo " Downloading $name -> $filename"
89-
curl -L -H "Authorization: token ${{ secrets.SENTIENCE_CHROME_TOKEN }}" "$url" -o "$filename"
90-
elif [[ "$name" == pkg/* ]]; then
91-
# Asset name is "pkg/sentience_core.js" - create pkg directory
92-
mkdir -p pkg
93-
filename=$(basename "$name")
94-
echo " Downloading $name -> pkg/$filename"
95-
curl -L -H "Authorization: token ${{ secrets.SENTIENCE_CHROME_TOKEN }}" "$url" -o "pkg/$filename"
96-
else
97-
# Asset name is just "manifest.json" - put at root
98-
dir=$(dirname "$name")
99-
if [ "$dir" != "." ]; then
100-
mkdir -p "$dir"
101-
fi
102-
echo " Downloading $name"
103-
curl -L -H "Authorization: token ${{ secrets.SENTIENCE_CHROME_TOKEN }}" "$url" -o "$name"
104-
fi
105-
fi
106-
done
107-
108-
# Verify downloaded files
109-
echo "📋 Downloaded files structure:"
110-
find . -type f -name "*.js" -o -name "*.wasm" -o -name "*.json" | sort
111-
echo ""
112-
echo "Directory structure:"
113-
ls -laR . | head -50
84+
"$TARBALL_URL" -o extension-files.tar.gz
85+
86+
# Verify download
87+
if [ ! -f "extension-files.tar.gz" ]; then
88+
echo "❌ Failed to download extension-files.tar.gz"
89+
exit 1
90+
fi
91+
92+
TARBALL_SIZE=$(wc -c < extension-files.tar.gz)
93+
echo "✅ Downloaded extension-files.tar.gz ($TARBALL_SIZE bytes)"
94+
95+
# Extract tar.gz (preserves directory structure)
96+
echo "📦 Extracting extension-files.tar.gz..."
97+
tar -xzf extension-files.tar.gz
98+
rm extension-files.tar.gz
99+
100+
# Verify extracted files
101+
echo "📋 Extracted files structure:"
102+
find . -type f | sort
114103
echo ""
115104
echo "🔍 Verifying critical files:"
116105
if [ -f "manifest.json" ]; then
117-
echo "✅ manifest.json found ($(wc -c < manifest.json) bytes)"
106+
size=$(wc -c < manifest.json)
107+
echo "✅ manifest.json found ($size bytes)"
108+
if [ "$size" -lt 100 ]; then
109+
echo "⚠️ manifest.json seems too small, showing content:"
110+
cat manifest.json
111+
exit 1
112+
fi
118113
head -5 manifest.json
119114
else
120115
echo "❌ manifest.json NOT FOUND"
116+
exit 1
121117
fi
122118
if [ -d "pkg" ]; then
123119
echo "✅ pkg directory found with $(ls -1 pkg | wc -l) files"
120+
ls -lh pkg/
124121
else
125122
echo "❌ pkg directory NOT FOUND"
123+
exit 1
126124
fi
127125
128126
- name: Copy extension files

0 commit comments

Comments
 (0)