Windows ReadMe updates #6
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: Nightly Release (multiplatform) | |
| on: | |
| workflow_dispatch: | |
| push: | |
| jobs: | |
| build_linux: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| jdk: [21] | |
| libyara_tag: [ "v4.5.2-subreption" ] | |
| steps: | |
| # Step 1: Checkout the repository | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| # Step 2: Set up JDK | |
| - name: Set up JDK ${{ matrix.jdk }} | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'oracle' | |
| java-version: ${{ matrix.jdk }} | |
| settings-path: ${{ github.workspace }} | |
| - name: Clone libyara (${{ matrix.libyara_tag }}) | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: subreption/yara | |
| path: yara | |
| ref: ${{ matrix.libyara_tag }} | |
| token: ${{ secrets.GH_YARA_REPO_PAT }} | |
| # Step 3: Build libyara on Linux | |
| - name: Build libyara (${{ matrix.libyara_tag }}) | |
| run: | | |
| cd yara | |
| ./bootstrap.sh | |
| ./configure --without-crypto --enable-area --disable-shared CFLAGS=-fPIC | |
| make | |
| echo "YARA_HOME=$PWD" >> $GITHUB_ENV | |
| # Step 4: Build YARA-Java on Linux | |
| - name: Build YARA-Java | |
| run: mvn -B package --file pom.xml | |
| env: | |
| YARA_HOME: ${{ env.YARA_HOME }} | |
| YARA_BINARY_PATH: ${{ env.YARA_HOME }}/yara | |
| YARAC_BINARY_PATH: ${{ env.YARA_HOME }}/yarac | |
| - name: Upload linux64 build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: linux64-artifacts | |
| path: target/*.jar | |
| overwrite: true | |
| - name: Set up Maven settings.xml for GitHub Packages | |
| run: | | |
| mkdir -p ~/.m2 | |
| echo "<settings><servers><server><id>github</id><username>${{ github.actor }}</username><password>${{ secrets.GITHUB_TOKEN }}</password></server></servers></settings>" > ~/.m2/settings.xml | |
| - name: Deploy Maven artifacts | |
| run: mvn deploy -s ~/.m2/settings.xml -DaltDeploymentRepository=github::default::https://maven.pkg.github.com/${{ github.repository }} || echo "Deployment failed but continuing..." | |
| - name: Cleanup | |
| run: | | |
| rm -rf ~/.m2/settings.xml | |
| outputs: | |
| linux-artifact: ${{ steps.build.outputs.maven-artifact }} | |
| build_mac: | |
| runs-on: macos-latest | |
| strategy: | |
| matrix: | |
| jdk: [21] | |
| libyara_tag: [ "v4.5.2-subreption" ] | |
| steps: | |
| # Step 1: Checkout the repository | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| # Step 2: Set up JDK 21 on macOS | |
| - name: Set up JDK on macOS | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'oracle' | |
| java-version: ${{ matrix.jdk }} | |
| settings-path: ${{ github.workspace }} | |
| - name: Install dependencies | |
| run: | | |
| brew install \ | |
| autoconf \ | |
| automake \ | |
| bison \ | |
| flex \ | |
| libtool \ | |
| pkg-config \ | |
| jansson \ | |
| libmagic \ | |
| openssl@3 \ | |
| protobuf \ | |
| protobuf-c | |
| - name: Print versions | |
| run: | | |
| bison --version | |
| gcc --version | |
| - name: Clone libyara (${{ matrix.libyara_tag }}) | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: subreption/yara | |
| path: yara | |
| ref: ${{ matrix.libyara_tag }} | |
| token: ${{ secrets.GH_YARA_REPO_PAT }} | |
| # Step 3: Build libyara on macOS | |
| - name: Build libyara on macOS (${{ matrix.libyara_tag }}) | |
| run: | | |
| cd yara | |
| ./bootstrap.sh | |
| ./configure --without-crypto --enable-area --disable-shared CFLAGS=-fPIC | |
| make | |
| echo "YARA_HOME=$PWD" >> $GITHUB_ENV | |
| - name: List current working directory | |
| run: ls -lhRt | |
| # Step 4: Build YARA-Java on macOS | |
| - name: Build YARA-Java (macOS) | |
| run: mvn -B package --file pom.xml | |
| env: | |
| YARA_HOME: ${{ env.YARA_HOME }} | |
| YARA_BINARY_PATH: ${{ env.YARA_HOME }}/yara | |
| YARAC_BINARY_PATH: ${{ env.YARA_HOME }}/yarac | |
| - name: Set up Maven settings.xml for GitHub Packages | |
| run: | | |
| mkdir -p ~/.m2 | |
| echo "<settings><servers><server><id>github</id><username>${{ github.actor }}</username><password>${{ secrets.GITHUB_TOKEN }}</password></server></servers></settings>" > ~/.m2/settings.xml | |
| - name: Deploy Maven artifacts | |
| run: mvn deploy -Pmac -am -s ~/.m2/settings.xml -DaltDeploymentRepository=github::default::https://maven.pkg.github.com/${{ github.repository }} || echo "Deployment failed but continuing..." | |
| env: | |
| YARA_HOME: ${{ env.YARA_HOME }} | |
| YARA_BINARY_PATH: ${{ env.YARA_HOME }}/yara | |
| YARAC_BINARY_PATH: ${{ env.YARA_HOME }}/yarac | |
| - name: Cleanup | |
| run: | | |
| rm -rf ~/.m2/settings.xml | |
| - name: Show versions | |
| run: | | |
| bison --version | |
| gcc --version | |
| - name: Upload osx64 build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: osx64-artifacts | |
| path: target/*-osx64.jar | |
| overwrite: true | |
| outputs: | |
| mac-artifact: ${{ steps.build.outputs.maven-artifact }} | |
| build_windows64: | |
| runs-on: windows-latest | |
| strategy: | |
| matrix: | |
| jdk: [21] | |
| libyara_tag: [ "v4.5.2-subreption" ] | |
| arch: [windows64] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK ${{ matrix.jdk }} | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'oracle' | |
| java-version: ${{ matrix.jdk }} | |
| settings-path: ${{ github.workspace }} | |
| - name: Set up MSVC developer environment (x64) | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| with: | |
| arch: x64 | |
| - name: Set up NuGet | |
| uses: NuGet/setup-nuget@v2 | |
| - name: Clone libyara (${{ matrix.libyara_tag }}) | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: subreption/yara | |
| path: yara | |
| ref: ${{ matrix.libyara_tag }} | |
| token: ${{ secrets.GH_YARA_REPO_PAT }} | |
| # packages.config is not auto-restored by MSBuild. | |
| - name: Restore libyara NuGet packages | |
| run: nuget restore yara/windows/vs2017/yara.sln | |
| # libyara only (JNI embedded; no yara/yarac). | |
| - name: Build libyara (MSVC Release|x64) | |
| run: | | |
| msbuild "yara/windows/vs2017/libyara/libyara.vcxproj" /p:Configuration=Release /p:Platform=x64 /v:minimal | |
| if ($LASTEXITCODE -ne 0) { throw "msbuild failed for libyara" } | |
| - name: Export YARA_HOME | |
| run: echo "YARA_HOME=${{ github.workspace }}\yara" >> $env:GITHUB_ENV | |
| - name: Build YARA-Java (Windows) | |
| run: mvn -B package --file pom.xml | |
| env: | |
| YARA_HOME: ${{ env.YARA_HOME }} | |
| - name: Upload windows64 build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.arch }}-artifacts | |
| path: target/*-windows64.jar | |
| overwrite: true | |
| - name: Set up Maven settings.xml for GitHub Packages | |
| shell: bash | |
| run: | | |
| mkdir -p ~/.m2 | |
| echo "<settings><servers><server><id>github</id><username>${{ github.actor }}</username><password>${{ secrets.GITHUB_TOKEN }}</password></server></servers></settings>" > ~/.m2/settings.xml | |
| - name: Deploy Maven artifacts | |
| shell: bash | |
| run: mvn deploy -s ~/.m2/settings.xml -DaltDeploymentRepository=github::default::https://maven.pkg.github.com/${{ github.repository }} || echo "Deployment failed but continuing..." | |
| env: | |
| YARA_HOME: ${{ env.YARA_HOME }} | |
| - name: Cleanup | |
| shell: bash | |
| run: rm -rf ~/.m2/settings.xml | |
| bundle: | |
| needs: [build_linux, build_mac, build_windows64] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: linux64-artifacts | |
| path: build/linux64 | |
| - name: Download macOS build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: osx64-artifacts | |
| path: build/osx64 | |
| - name: Download windows64 build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: windows64-artifacts | |
| path: build/windows64 | |
| - name: List current working directory | |
| run: ls -lhRt | |
| # Step to bundle Linux, macOS, and Windows JARs | |
| - name: Bundle multiplatform JARs | |
| run: | | |
| mkdir -p bundled-jars | |
| cp build/linux64/*.jar bundled-jars/ | |
| cp build/osx64/*.jar bundled-jars/ | |
| cp build/windows64/*.jar bundled-jars/ | |
| - name: Upload bundled JARs | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: bundled-jars | |
| path: bundled-jars | |
| outputs: | |
| maven-artifact: bundled-jars | |
| release: | |
| runs-on: ubuntu-latest | |
| needs: bundle | |
| strategy: | |
| matrix: | |
| jdk: [21] | |
| libyara_tag: ["v4.5.2-subreption"] | |
| steps: | |
| - name: Download build artifacts (jars) | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: bundled-jars | |
| - name: List current working directory | |
| run: ls -lhRt | |
| - name: Set Date for Nightly Release | |
| run: echo "RELEASE_DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV | |
| - name: Create GitHub Nightly Release | |
| if: github.ref == 'refs/heads/main' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: latest | |
| name: Nightly (multiplatform) - ${{ env.RELEASE_DATE }} | |
| draft: false | |
| prerelease: true | |
| generate_release_notes: true | |
| files: ./*.jar | |
| fail_on_unmatched_files: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |