This repository has been archived by the owner on Nov 19, 2024. It is now read-only.
Bump binaryninja-api #40
This file contains 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 | |
on: | |
workflow_dispatch: | |
inputs: | |
level: | |
type: choice | |
description: "New version bump" | |
required: true | |
options: | |
- major | |
- minor | |
- patch | |
default: patch | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
env: | |
CONFIGURE_PRESET: default-release | |
jobs: | |
bump: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
outputs: | |
version: ${{ steps.semver.outputs.new_version }} | |
steps: | |
- uses: actions/checkout@v4 | |
if: github.event_name == 'workflow_dispatch' | |
- name: Find last version | |
if: github.event_name == 'workflow_dispatch' | |
id: get-version | |
run: echo "version=$(jq --raw-output '.version' plugin.json)" >> $GITHUB_OUTPUT | |
- uses: actions-ecosystem/action-bump-semver@v1 | |
if: github.event_name == 'workflow_dispatch' | |
id: semver | |
with: | |
current_version: ${{ steps.get-version.outputs.version }} | |
level: ${{ github.event.inputs.level }} | |
- name: Bump plugin.json version | |
if: github.event_name == 'workflow_dispatch' | |
run: | | |
jq --rawfile readme README.md '.version = "${{ steps.semver.outputs.new_version }}" | .longdescription = $readme' plugin.json > plugin.json.tmp | |
mv plugin.json.tmp plugin.json | |
- name: Commit changes | |
if: github.event_name == 'workflow_dispatch' | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
branch: master | |
commit_message: Bump version to ${{ steps.semver.outputs.new_version }} | |
tagging_message: "v${{ steps.semver.outputs.new_version }}" | |
build: | |
strategy: | |
matrix: | |
platform: | |
- runs_on: ubuntu | |
binary: libbinja-msvc.so | |
build_path: /build/ | |
- runs_on: windows | |
binary: binja-msvc.dll | |
build_path: \build\Debug\ | |
- runs_on: macos | |
binary: libbinja-msvc.dylib | |
build_path: /build/ | |
runs-on: ${{matrix.platform.runs_on}}-latest | |
needs: bump | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup Binary Ninja | |
working-directory: ${{github.workspace}}/binaryninja-api | |
run: git apply ../.github/binaryninja-api-headless.patch | |
- name: Build | |
run: | | |
cmake -S . -B build -DHEADLESS=1 -DBN_INSTALL_DIR=binaryninja-api | |
cmake --build build | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: lib-${{matrix.platform.runs_on}} | |
path: ${{github.workspace}}${{matrix.platform.build_path}}${{matrix.platform.binary}} | |
if-no-files-found: error | |
release: | |
runs-on: ubuntu-latest | |
if: github.event_name == 'workflow_dispatch' | |
needs: | |
- build | |
- bump | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
merge-multiple: true | |
- name: Create release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "*" | |
artifactErrorsFailBuild: true | |
tag: "${{ needs.bump.outputs.version }}" |