From 98879e463563d6713bcee5e10112a2e9ec3288bc Mon Sep 17 00:00:00 2001 From: sbrptdev2 <181986753+sbrptdev2@users.noreply.github.com> Date: Thu, 10 Oct 2024 23:04:34 +0200 Subject: [PATCH] Updated README, added multiplatform CI and automatic release staging. Maven packages repo needs to be updated. --- .github/workflows/ci_nightly.yml | 42 +++++++++++++++++++++++++++++--- .github/workflows/ci_release.yml | 31 ++++++++++++++++++++++- README.md | 3 +-- 3 files changed, 69 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci_nightly.yml b/.github/workflows/ci_nightly.yml index a0b4506..fce0e29 100644 --- a/.github/workflows/ci_nightly.yml +++ b/.github/workflows/ci_nightly.yml @@ -57,23 +57,41 @@ jobs: name: linux64-artifacts path: target/*.jar overwrite: true + + - name: Set up Maven settings.xml for GitHub Packages + run: | + mkdir -p ~/.m2 + echo "github${{ github.actor }}${{ secrets.GITHUB_TOKEN }}" > ~/.m2/settings.xml + + - name: Deploy Maven artifacts + run: mvn deploy -s ~/.m2/settings.xml -DaltDeploymentRepository=github::default::https://maven.pkg.github.com/${{ github.repository }} + + - 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 21 on macOS + - name: Set up JDK on macOS uses: actions/setup-java@v4 with: distribution: 'oracle' - java-version: 21 + java-version: ${{ matrix.jdk }} settings-path: ${{ github.workspace }} - name: Install dependencies @@ -121,6 +139,22 @@ jobs: 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 "github${{ github.actor }}${{ secrets.GITHUB_TOKEN }}" > ~/.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 }} + 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 @@ -194,8 +228,8 @@ jobs: if: github.ref == 'refs/heads/main' uses: softprops/action-gh-release@v2 with: - tag_name: ${{ github.ref }} - name: Release ${{ github.ref }} (multiplatform) + tag_name: latest + name: Nightly (multiplatform) draft: false prerelease: true generate_release_notes: true diff --git a/.github/workflows/ci_release.yml b/.github/workflows/ci_release.yml index b738941..039209a 100644 --- a/.github/workflows/ci_release.yml +++ b/.github/workflows/ci_release.yml @@ -61,6 +61,18 @@ jobs: name: ${{ matrix.arch }}-artifacts path: target/*.jar if-no-files-found: error + + - name: Set up Maven settings.xml for GitHub Packages + run: | + mkdir -p ~/.m2 + echo "github${{ github.actor }}${{ secrets.GITHUB_TOKEN }}" > ~/.m2/settings.xml + + - name: Deploy Maven artifacts + run: mvn deploy -s ~/.m2/settings.xml -DaltDeploymentRepository=github::default::https://maven.pkg.github.com/${{ github.repository }} + + - name: Cleanup + run: | + rm -rf ~/.m2/settings.xml outputs: linux-artifact: ${{ steps.build.outputs.maven-artifact }} @@ -78,7 +90,7 @@ jobs: uses: actions/setup-java@v4 with: distribution: 'oracle' - java-version: 21 + java-version: ${{ matrix.jdk }} settings-path: ${{ github.workspace }} - name: Install dependencies @@ -126,6 +138,19 @@ jobs: 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 "github${{ github.actor }}${{ secrets.GITHUB_TOKEN }}" > ~/.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 }} + env: + YARA_HOME: ${{ env.YARA_HOME }} + YARA_BINARY_PATH: ${{ env.YARA_HOME }}/yara + YARAC_BINARY_PATH: ${{ env.YARA_HOME }}/yarac + + - name: List built run: | bison --version @@ -138,6 +163,10 @@ jobs: path: target/*-osx64.jar overwrite: true + - name: Cleanup + run: | + rm -rf ~/.m2/settings.xml + outputs: mac-artifact: ${{ steps.build.outputs.maven-artifact }} diff --git a/README.md b/README.md index 207ac29..cf52e4b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ -![build](https://github.com/subreption/yara-java/actions/workflows/ci.yml/badge.svg) -[![Stable Release linux64](https://github.com/subreption/yara-java/actions/workflows/ci_release.yml/badge.svg)](https://github.com/subreption/yara-java/actions/workflows/ci_release.yml) +[![Build (linux64)](https://github.com/subreption/yara-java/actions/workflows/build_linux64.yml/badge.svg)](https://github.com/subreption/yara-java/actions/workflows/build_linux64.yml) [![Build (multiplatform)](https://github.com/subreption/yara-java/actions/workflows/build_multi.yml/badge.svg)](https://github.com/subreption/yara-java/actions/workflows/build_multi.yml) [![Build (osx64)](https://github.com/subreption/yara-java/actions/workflows/build_macos.yml/badge.svg)](https://github.com/subreption/yara-java/actions/workflows/build_macos.yml) [![Nightly Release (multiplatform)](https://github.com/subreption/yara-java/actions/workflows/ci_nightly.yml/badge.svg)](https://github.com/subreption/yara-java/actions/workflows/ci_nightly.yml) [![Stable Release multiplatform](https://github.com/subreption/yara-java/actions/workflows/ci_release.yml/badge.svg)](https://github.com/subreption/yara-java/actions/workflows/ci_release.yml) ## Introduction