|
| 1 | +name: Build Acode Plugin |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: ["main"] |
| 6 | + pull_request: |
| 7 | + branches: ["main"] |
| 8 | + workflow_dispatch: {} |
| 9 | + |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + |
| 14 | + steps: |
| 15 | + - name: Checkout repository |
| 16 | + uses: actions/checkout@v4 |
| 17 | + |
| 18 | + - name: Setup Node.js |
| 19 | + uses: actions/setup-node@v4 |
| 20 | + with: |
| 21 | + node-version: '20' |
| 22 | + cache: 'npm' |
| 23 | + |
| 24 | + - name: Install dependencies |
| 25 | + shell: bash |
| 26 | + run: | |
| 27 | + npm install |
| 28 | +
|
| 29 | + - name: Run build script (show stdout/stderr) |
| 30 | + shell: bash |
| 31 | + run: | |
| 32 | + echo "== RUNNING BUILD ==" |
| 33 | + node -v |
| 34 | + npm -v |
| 35 | + set -o pipefail |
| 36 | + npm run build 2>&1 | tee build-output.log || true |
| 37 | + echo "=== BUILD OUTPUT (last 200 lines) ===" |
| 38 | + tail -n 200 build-output.log || true |
| 39 | +
|
| 40 | + - name: Debug - show workspace recursively |
| 41 | + shell: bash |
| 42 | + run: | |
| 43 | + echo "Working dir: $(pwd)" |
| 44 | + echo "Top-level files:" |
| 45 | + ls -la |
| 46 | + echo "Find zip files (if any):" |
| 47 | + find . -type f -name "*.zip" -print -exec ls -lh {} \; || true |
| 48 | +
|
| 49 | + - name: Prepare artifacts |
| 50 | + shell: bash |
| 51 | + run: | |
| 52 | + mkdir -p .artifacts |
| 53 | + |
| 54 | + # Kalau AI.zip sudah ada di repo, pakai itu |
| 55 | + if [ -f "AI.zip" ]; then |
| 56 | + cp AI.zip .artifacts/ |
| 57 | + echo "✅ Copied AI.zip to artifacts" |
| 58 | + else |
| 59 | + echo "❌ AI.zip not found, creating from dist" |
| 60 | + if [ -d "dist" ]; then |
| 61 | + # Bikin zip clean → isi dist/* langsung di root zip |
| 62 | + if [ -f "README.md" ]; then |
| 63 | + zip -r .artifacts/AI.zip dist/* plugin.json icon.png README.md |
| 64 | + elif [ -f "readme.md" ]; then |
| 65 | + zip -r .artifacts/AI.zip dist/* plugin.json icon.png readme.md |
| 66 | + else |
| 67 | + zip -r .artifacts/AI.zip dist/* plugin.json icon.png |
| 68 | + fi |
| 69 | + else |
| 70 | + echo "❌ No dist folder found" |
| 71 | + exit 1 |
| 72 | + fi |
| 73 | + fi |
| 74 | + |
| 75 | + echo "=== Final artifacts check ===" |
| 76 | + ls -la .artifacts/ |
| 77 | + file .artifacts/AI.zip |
| 78 | + echo "File exists check:" |
| 79 | + test -f .artifacts/AI.zip && echo "✅ AI.zip exists" || echo "❌ AI.zip missing" |
| 80 | +
|
| 81 | + - name: Upload plugin artifact |
| 82 | + uses: actions/upload-artifact@v4 |
| 83 | + with: |
| 84 | + name: acode-plugin-ai |
| 85 | + path: .artifacts/AI.zip |
| 86 | + if-no-files-found: error |
0 commit comments