@@ -65,25 +65,44 @@ jobs:
6565
6666 # Download individual files from release (reliable method - no zip)
6767 echo "📁 Downloading individual files from release..."
68+ echo "Available release assets:"
69+ curl -s -H "Authorization: token ${{ secrets.SENTIENCE_CHROME_TOKEN }}" \
70+ "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+
6873 curl -L -H "Authorization: token ${{ secrets.SENTIENCE_CHROME_TOKEN }}" \
6974 "https://api.github.com/repos/$REPO/releases/tags/$TAG" | \
7075 jq -r '.assets[] | select(.name | endswith(".js") or endswith(".wasm") or endswith(".json") or endswith(".d.ts")) | "\(.browser_download_url)|\(.name)"' | \
7176 while IFS='|' read -r url name; do
7277 if [ -n "$url" ] && [ "$url" != "null" ] && [ -n "$name" ]; then
73- # Preserve directory structure from asset name
74- # If name contains '/', create directories
75- dir=$(dirname "$name")
76- if [ "$dir" != "." ]; then
77- mkdir -p "$dir"
78+ # Handle asset names that might have paths like "pkg/sentience_core.js"
79+ # GitHub releases might preserve directory structure in asset names
80+ # If name starts with "pkg/", we want to preserve that structure
81+ # If name is just a filename, put it at root
82+ if [[ "$name" == pkg/* ]]; then
83+ # Asset name is "pkg/sentience_core.js" - create pkg directory
84+ mkdir -p pkg
85+ filename=$(basename "$name")
86+ echo " Downloading $name -> pkg/$filename"
87+ curl -L -H "Authorization: token ${{ secrets.SENTIENCE_CHROME_TOKEN }}" "$url" -o "pkg/$filename"
88+ else
89+ # Asset name is just "manifest.json" - put at root
90+ dir=$(dirname "$name")
91+ if [ "$dir" != "." ]; then
92+ mkdir -p "$dir"
93+ fi
94+ echo " Downloading $name"
95+ curl -L -H "Authorization: token ${{ secrets.SENTIENCE_CHROME_TOKEN }}" "$url" -o "$name"
7896 fi
79- echo " Downloading $name..."
80- curl -L -H "Authorization: token ${{ secrets.SENTIENCE_CHROME_TOKEN }}" "$url" -o "$name"
8197 fi
8298 done
8399
84100 # Verify downloaded files
85- echo "📋 Downloaded files:"
86- ls -la
101+ echo "📋 Downloaded files structure:"
102+ find . -type f -name "*.js" -o -name "*.wasm" -o -name "*.json" | sort
103+ echo ""
104+ echo "Directory structure:"
105+ ls -laR . | head -50
87106
88107 - name : Copy extension files
89108 if : steps.release.outputs.skip != 'true'
@@ -125,48 +144,94 @@ jobs:
125144 echo "⚠️ injected_api.js not found"
126145 fi
127146
128- # Copy WASM files (check both locations)
129- if [ -f "extension-temp/pkg/sentience_core.js" ]; then
130- cp extension-temp/pkg/sentience_core.js sentience/extension/pkg/
131- elif [ -f "extension-temp/extension-package/pkg/sentience_core.js" ]; then
132- cp extension-temp/extension-package/pkg/sentience_core.js sentience/extension/pkg/
133- else
134- echo "⚠️ sentience_core.js not found"
135- fi
136-
137- if [ -f "extension-temp/pkg/sentience_core_bg.wasm" ]; then
138- cp extension-temp/pkg/sentience_core_bg.wasm sentience/extension/pkg/
139- elif [ -f "extension-temp/extension-package/pkg/sentience_core_bg.wasm" ]; then
140- cp extension-temp/extension-package/pkg/sentience_core_bg.wasm sentience/extension/pkg/
141- else
142- echo "⚠️ sentience_core_bg.wasm not found"
143- fi
147+ # Copy WASM files - try multiple locations and patterns
148+ echo "🔍 Searching for pkg directory and WASM files..."
144149
145- # Copy TypeScript definitions
150+ # Check all possible locations
146151 if [ -d "extension-temp/pkg" ]; then
147- cp extension-temp/pkg/*.d.ts sentience/extension/pkg/ 2>/dev/null || echo "⚠️ Type definitions not found"
152+ echo "✅ Found pkg directory at extension-temp/pkg"
153+ cp -r extension-temp/pkg/* sentience/extension/pkg/ 2>/dev/null || true
148154 elif [ -d "extension-temp/extension-package/pkg" ]; then
149- cp extension-temp/extension-package/pkg/*.d.ts sentience/extension/pkg/ 2>/dev/null || echo "⚠️ Type definitions not found"
155+ echo "✅ Found pkg directory at extension-temp/extension-package/pkg"
156+ cp -r extension-temp/extension-package/pkg/* sentience/extension/pkg/ 2>/dev/null || true
157+ else
158+ echo "⚠️ pkg directory not found, searching for individual files..."
159+
160+ # Search for files in various locations
161+ find extension-temp -name "sentience_core.js" -type f | while read file; do
162+ echo " Found: $file"
163+ cp "$file" sentience/extension/pkg/ 2>/dev/null || true
164+ done
165+
166+ find extension-temp -name "sentience_core_bg.wasm" -type f | while read file; do
167+ echo " Found: $file"
168+ cp "$file" sentience/extension/pkg/ 2>/dev/null || true
169+ done
170+
171+ find extension-temp -name "*.d.ts" -type f | while read file; do
172+ echo " Found: $file"
173+ cp "$file" sentience/extension/pkg/ 2>/dev/null || true
174+ done
150175 fi
151176
152177 # Verify copied files
153178 echo "📋 Copied files:"
154- ls -la sentience/extension/
155- ls -la sentience/extension/pkg/ 2>/dev/null || echo "⚠️ pkg directory not created"
179+ echo "Extension root:"
180+ ls -la sentience/extension/ || echo "⚠️ Extension directory empty"
181+ echo ""
182+ echo "WASM files (pkg directory):"
183+ if [ -d "sentience/extension/pkg" ]; then
184+ ls -la sentience/extension/pkg/ || echo "⚠️ pkg directory empty"
185+ else
186+ echo "❌ ERROR: pkg directory not created!"
187+ exit 1
188+ fi
189+
190+ # Verify required files exist
191+ if [ ! -f "sentience/extension/pkg/sentience_core.js" ]; then
192+ echo "❌ ERROR: sentience_core.js not found!"
193+ exit 1
194+ fi
195+ if [ ! -f "sentience/extension/pkg/sentience_core_bg.wasm" ]; then
196+ echo "❌ ERROR: sentience_core_bg.wasm not found!"
197+ exit 1
198+ fi
199+ echo "✅ All required WASM files verified"
156200
157201 - name : Check for changes
158202 if : steps.release.outputs.skip != 'true'
159203 id : changes
160204 run : |
161205 git config --local user.email "action@github.com"
162206 git config --local user.name "GitHub Action"
163- git add sentience/extension/ || true
207+
208+ # Show what files exist before adding
209+ echo "📋 Files in sentience/extension before git add:"
210+ find sentience/extension -type f | sort || echo "No files found"
211+
212+ # Add all files including binary files
213+ # Use -f to force add in case files are in .gitignore
214+ git add -f sentience/extension/ || true
215+
216+ # Show what was staged
217+ echo "📋 Staged files:"
218+ git diff --staged --name-only || echo "No staged files"
219+
220+ # Check if there are actual changes
164221 if git diff --staged --quiet; then
165222 echo "changed=false" >> $GITHUB_OUTPUT
166223 echo "No changes detected"
167224 else
168225 echo "changed=true" >> $GITHUB_OUTPUT
169226 echo "Changes detected"
227+ # Show file sizes to verify binary files are included
228+ echo "📊 Staged file sizes:"
229+ git diff --staged --name-only | while read file; do
230+ if [ -f "$file" ]; then
231+ size=$(ls -lh "$file" | awk '{print $5}')
232+ echo " $file: $size"
233+ fi
234+ done
170235 fi
171236
172237 - name : Create Pull Request
0 commit comments