Update main.yml #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Acode Plugin | ||
| on: | ||
| push: | ||
| branches: ["main"] | ||
| pull_request: | ||
| branches: ["main"] | ||
| workflow_dispatch: | ||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
| cache: 'npm' | ||
| - name: Install dependencies | ||
| run: npm install | ||
| - name: Run build script (show stdout/stderr) | ||
| run: | | ||
| echo "== RUNNING BUILD ==" | ||
| node -v | ||
| npm -v | ||
| set -o pipefail | ||
| npm run build 2>&1 | tee build-output.log || true | ||
| echo "=== BUILD OUTPUT (last 200 lines) ===" | ||
| tail -n 200 build-output.log || true | ||
| - name: Debug: show workspace recursively | ||
| run: | | ||
| echo "Working dir: $(pwd)" | ||
| echo "Top-level files:" | ||
| ls -la | ||
| echo "Find zip files (if any):" | ||
| find . -type f -name "*.zip" -print -exec ls -lh {} \; || true | ||
| echo "Show dist folder (if exists):" | ||
| if [ -d "dist" ]; then ls -la dist; else echo "dist/ not found"; fi | ||
| echo "Show .acode folder (if exists):" | ||
| ls -la .acode || true | ||
| - name: Ensure zip tool present | ||
| run: | | ||
| if ! command -v zip >/dev/null; then | ||
| sudo apt-get update && sudo apt-get install -y zip | ||
| fi | ||
| zip -v || true | ||
| - name: Create artifact zip (guaranteed) | ||
| run: | | ||
| mkdir -p .artifacts | ||
| found=0 | ||
| while IFS= read -r f; do | ||
| echo "Copying existing zip: $f" | ||
| cp "$f" .artifacts/ || true | ||
| found=1 | ||
| done < <(find . -type f -name "*.zip" -print) | ||
| if [ "$found" -eq 0 ]; then | ||
| echo "No existing zip found — creating .artifacts/acode-plugin.zip from dist/ + manifest.json" | ||
| if [ -d "dist" ]; then | ||
| if [ -f "manifest.json" ]; then | ||
| zip -r .artifacts/acode-plugin.zip dist manifest.json > /dev/null || true | ||
| else | ||
| zip -r .artifacts/acode-plugin.zip dist > /dev/null || true | ||
| fi | ||
| else | ||
| echo "ERROR: dist/ not found. Listing current dir:" | ||
| ls -la | ||
| fi | ||
| fi | ||
| echo "Contents of .artifacts:" | ||
| ls -la .artifacts || true | ||
| - name: Upload plugin artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: acode-plugin | ||
| path: .artifacts/*.zip | ||