|
| 1 | +name: Publish |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [published] |
| 6 | + |
| 7 | +concurrency: |
| 8 | + group: release-${{ github.event.release.tag_name }} |
| 9 | + cancel-in-progress: false |
| 10 | + |
| 11 | +jobs: |
| 12 | + build: |
| 13 | + name: Build Plugin (${{ matrix.os }}, py${{ matrix.python }}, ${{ matrix.arch }}) |
| 14 | + runs-on: ${{ matrix.os }} |
| 15 | + |
| 16 | + strategy: |
| 17 | + fail-fast: false |
| 18 | + matrix: |
| 19 | + include: |
| 20 | + - os: macos-latest |
| 21 | + python: "3.10" |
| 22 | + arch: arm64 |
| 23 | + package-name: macos_arm64 |
| 24 | + - os: macos-15-intel |
| 25 | + python: "3.10" |
| 26 | + arch: x86_64 |
| 27 | + package-name: macos_x86_64 |
| 28 | + - os: windows-latest |
| 29 | + python: "3.10" |
| 30 | + arch: x86_64 |
| 31 | + package-name: windows_x86_64 |
| 32 | + |
| 33 | + steps: |
| 34 | + - name: Checkout code |
| 35 | + uses: actions/checkout@v4 |
| 36 | + |
| 37 | + - name: Set up Python ${{ matrix.python }} |
| 38 | + uses: actions/setup-python@v5 |
| 39 | + with: |
| 40 | + python-version: ${{ matrix.python }} |
| 41 | + |
| 42 | + - name: Install uv |
| 43 | + uses: astral-sh/setup-uv@v6 |
| 44 | + |
| 45 | + - name: Install build tools |
| 46 | + run: python -m pip install --upgrade pip setuptools wheel |
| 47 | + |
| 48 | + - name: Build vendor dependencies |
| 49 | + run: | |
| 50 | + rm -rf images |
| 51 | + mkdir -p reai_toolkit/vendor |
| 52 | + uv pip install . --target reai_toolkit/vendor --no-cache-dir |
| 53 | + rm -rf reai_toolkit/vendor/reai_toolkit |
| 54 | + rm -rf reai_toolkit/vendor/reai_toolkit-*.dist-info |
| 55 | + shell: bash |
| 56 | + |
| 57 | + - name: Verify vendor folder contents |
| 58 | + run: | |
| 59 | + echo "Listing vendor packages:" |
| 60 | + find reai_toolkit/vendor -maxdepth 2 -type d -print0 | head -n 50 |
| 61 | + shell: bash |
| 62 | + |
| 63 | + - name: Package plugin for release (cross-platform) |
| 64 | + run: | |
| 65 | + python - <<'PY' |
| 66 | + import zipfile, os |
| 67 | + from pathlib import Path |
| 68 | + |
| 69 | + os.makedirs("dist", exist_ok=True) |
| 70 | + zip_path = f"dist/reveng_binary_ninja_plugin_${{ matrix.package-name }}.zip" |
| 71 | + |
| 72 | + with zipfile.ZipFile(zip_path, 'w', zipfile.ZIP_DEFLATED) as zf: |
| 73 | + |
| 74 | + # Add all files from reai_toolkit/ to root of zip |
| 75 | + for root, dirs, files in os.walk("reai_toolkit"): |
| 76 | + for file in files: |
| 77 | + file_path = os.path.join(root, file) |
| 78 | + # Archive name is relative to reai_toolkit (removes the reai_toolkit/ prefix) |
| 79 | + arcname = os.path.relpath(file_path, ".") |
| 80 | + zf.write(file_path, arcname) |
| 81 | + PY |
| 82 | + shell: bash |
| 83 | + |
| 84 | + - name: Upload plugin artifact |
| 85 | + uses: actions/upload-artifact@v4 |
| 86 | + with: |
| 87 | + name: reveng_binary_ninja_plugin_${{ matrix.package-name }} |
| 88 | + path: dist/*.zip |
| 89 | + |
| 90 | + attach: |
| 91 | + name: Attach Artifacts to GitHub Release |
| 92 | + runs-on: macos-latest |
| 93 | + needs: build |
| 94 | + |
| 95 | + steps: |
| 96 | + - name: Download built artifacts |
| 97 | + uses: actions/download-artifact@v4 |
| 98 | + with: |
| 99 | + path: dist |
| 100 | + |
| 101 | + - name: List artifacts |
| 102 | + run: ls -R dist |
| 103 | + |
| 104 | + - name: Attach to published release |
| 105 | + uses: softprops/action-gh-release@v2 |
| 106 | + with: |
| 107 | + tag_name: ${{ github.event.release.tag_name }} |
| 108 | + name: ${{ github.event.release.name }} |
| 109 | + body: | |
| 110 | + RevEng.AI Binary Ninja Plugin |
| 111 | +
|
| 112 | + Extract into your Binary Ninja plugins folder. |
| 113 | + files: dist/**/*.zip |
| 114 | + env: |
| 115 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments