Bump softprops/action-gh-release from 1 to 2 #964
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: CI and Release | |
| env: | |
| R2V: 6.0.4 | |
| on: | |
| push: | |
| branches: | |
| - '**' | |
| tags: | |
| - '[0-9]*' | |
| # pull_request: | |
| jobs: | |
| build: | |
| name: Build (${{ matrix.os }} / ${{ matrix.build_system }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-24.04, macos-latest, windows-latest] | |
| build_system: [make, meson] | |
| exclude: | |
| - os: windows-latest | |
| build_system: make | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup Meson/Ninja | |
| if: matrix.build_system == 'meson' | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install meson ninja | |
| - name: Install radare2 on Linux | |
| if: matrix.os == 'ubuntu-24.04' | |
| run: | | |
| wget "https://github.com/radareorg/radare2/releases/download/${R2V}/radare2_${R2V}_amd64.deb" | |
| wget "https://github.com/radareorg/radare2/releases/download/${R2V}/radare2-dev_${R2V}_amd64.deb" | |
| sudo dpkg -i "radare2_${R2V}_amd64.deb" | |
| sudo dpkg -i "radare2-dev_${R2V}_amd64.deb" | |
| - name: Install radare2 on macOS | |
| if: matrix.os == 'macos-latest' | |
| run: | | |
| git clone --depth=1 --branch "${{env.R2V}}" https://github.com/radareorg/radare2 | |
| cd radare2 | |
| sys/install.sh | |
| - name: Install radare2 on Windows | |
| if: matrix.os == 'windows-latest' | |
| shell: powershell | |
| run: | | |
| $url = "https://github.com/radareorg/radare2/releases/download/${{ env.R2V }}/radare2-${{ env.R2V }}-w64.zip" | |
| $dest = "$env:TEMP\radare2.zip" | |
| Invoke-WebRequest -Uri $url -OutFile $dest -UseBasicParsing | |
| $prefix = 'C:\radare2' | |
| if (Test-Path $prefix) { Remove-Item -Path $prefix -Recurse -Force } | |
| Expand-Archive -Path $dest -DestinationPath $prefix -Force | |
| # Move contents from subdirectory if present | |
| $subdirs = Get-ChildItem -Path $prefix -Directory | |
| if ($subdirs.Count -eq 1) { | |
| $subdir = $subdirs[0] | |
| Get-ChildItem -Path $subdir.FullName | Move-Item -Destination $prefix -Force | |
| Remove-Item -Path $subdir.FullName -Recurse -Force | |
| } | |
| - name: Build with Make | |
| if: matrix.build_system == 'make' | |
| run: make -C src | |
| - name: Build with Meson (Unix) | |
| if: matrix.build_system == 'meson' && matrix.os != 'windows-latest' | |
| run: | | |
| cd src | |
| meson setup build -Dr2_prefix=${{ secrets.R2_PREFIX }} || meson configure build | |
| meson compile -C build | |
| - name: Build with Meson (Windows) | |
| if: matrix.build_system == 'meson' && matrix.os == 'windows-latest' | |
| shell: powershell | |
| run: | | |
| cd src | |
| $prefix = 'C:\radare2' | |
| meson setup build --backend ninja --prefix="$prefix" -Dr2_prefix="$prefix" | |
| if ($LASTEXITCODE -ne 0) { meson configure build } | |
| meson compile -C build | |
| - name: Create release artifacts (tags only) | |
| if: startsWith(github.ref, 'refs/tags/') | |
| shell: bash | |
| run: | | |
| mkdir -p release | |
| # Collect common binary artefact names produced by Make/Meson | |
| # Include both "r2ai.*" and "libr2ai.*" variants for DLL/dylib/so on all platforms. | |
| find src -type f \( -iname "r2ai.dll" -o -iname "libr2ai.dll" -o -iname "r2ai.dylib" -o -iname "libr2ai.dylib" -o -iname "r2ai.so" -o -iname "libr2ai.so" -o -iname "r2ai.exe" \) -exec cp -f {} release/ \; || true | |
| # Also check top-level build output directories | |
| find . -maxdepth 3 -type f \( -iname "r2ai.dll" -o -iname "libr2ai.dll" -o -iname "r2ai.dylib" -o -iname "libr2ai.dylib" -o -iname "r2ai.so" -o -iname "libr2ai.so" -o -iname "r2ai.exe" \) -exec cp -f {} release/ \; || true | |
| cp -f decai/decai.r2.js release/ || true | |
| if command -v zip >/dev/null 2>&1; then | |
| zip -j "release/r2ai-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.build_system }}.zip" release/* | |
| else | |
| powershell.exe -Command "Compress-Archive -Path release/* -DestinationPath 'release/r2ai-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.build_system }}.zip'" | |
| fi | |
| - name: Upload artifacts (tags only) | |
| if: startsWith(github.ref, 'refs/tags/') | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: ${{ matrix.os }}-${{ matrix.build_system }}-binary | |
| path: release/r2ai-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.build_system }}.zip | |
| # - name: Smoke test | |
| # run: | | |
| # if command -v r2 >/dev/null 2>&1; then | |
| # r2 -q -c 'r2ai -h' -- || true | |
| # fi | |
| release: | |
| name: Create Release | |
| needs: build | |
| if: startsWith(github.ref, 'refs/tags/') | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Verify tag is on master | |
| run: | | |
| git fetch origin master:refs/remotes/origin/master | |
| if ! git branch -r --contains ${GITHUB_SHA} | grep -q "origin/master"; then | |
| echo "Tag commit is not on origin/master — skipping release." | |
| exit 0 | |
| fi | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: release-artifacts | |
| - name: Add decai.r2.js to release artifacts | |
| run: cp decai/decai.r2.js release-artifacts/ | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| release-artifacts/**/*.zip | |
| release-artifacts/decai.r2.js | |
| generate_release_notes: true |