feat: Add CI/CD and release workflows #1
Workflow file for this run
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: release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'Release tag (e.g., v1.0.0)' | |
| required: true | |
| jobs: | |
| build: | |
| name: Build (${{ matrix.os }}) | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: linux | |
| runner: ubuntu-latest | |
| artifact_ext: so | |
| platform: linux-x86_64 | |
| - os: macos | |
| runner: macos-latest | |
| artifact_ext: dylib | |
| platform: macos-aarch64 | |
| - os: windows | |
| runner: windows-latest | |
| artifact_ext: dll | |
| platform: windows-x86_64 | |
| env: | |
| IDASDK: ${{ github.workspace }}/ida-sdk/src | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install pybind11 | |
| run: pip install pybind11 | |
| - name: Setup IDA SDK | |
| shell: bash | |
| run: | | |
| git clone --depth 1 https://github.com/HexRaysSA/ida-sdk ida-sdk | |
| git clone --depth 1 https://github.com/allthingsida/ida-cmake.git "${IDASDK}/ida-cmake" | |
| - name: Configure | |
| shell: bash | |
| run: | | |
| cmake -B build -DCMAKE_BUILD_TYPE=Release \ | |
| -Dpybind11_DIR="$(python -c 'import pybind11; print(pybind11.get_cmake_dir())')" | |
| - name: Build | |
| shell: bash | |
| run: cmake --build build --config Release | |
| - name: Package | |
| shell: bash | |
| run: | | |
| mkdir -p dist | |
| # Copy plugin | |
| find "${IDASDK}/bin/plugins" -name "python_ext.${{ matrix.artifact_ext }}" -exec cp {} dist/ \; 2>/dev/null || \ | |
| find build -name "python_ext.${{ matrix.artifact_ext }}" -exec cp {} dist/ \; | |
| # Copy Python module | |
| [ -f mymodule.py ] && cp mymodule.py dist/ | |
| # Copy docs | |
| [ -f README.md ] && cp README.md dist/ | |
| - name: Create archive | |
| shell: bash | |
| run: | | |
| cd dist | |
| if [ "${{ matrix.os }}" = "windows" ]; then | |
| 7z a ../python_ext-${{ matrix.platform }}.zip * | |
| else | |
| zip -r ../python_ext-${{ matrix.platform }}.zip * | |
| fi | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: python_ext-${{ matrix.platform }} | |
| path: python_ext-${{ matrix.platform }}.zip | |
| release: | |
| name: Create Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Get tag | |
| id: tag | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| echo "tag=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT | |
| else | |
| echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.tag.outputs.tag }} | |
| name: Release ${{ steps.tag.outputs.tag }} | |
| draft: false | |
| prerelease: false | |
| files: artifacts/**/*.zip | |
| generate_release_notes: true |