Skip to content

Commit

Permalink
Updated README, added multiplatform CI and automatic release staging.…
Browse files Browse the repository at this point in the history
… Maven packages repo needs to be updated.
  • Loading branch information
sbrptdev2 committed Oct 10, 2024
1 parent 0391dee commit 5ef1cd6
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 12 deletions.
47 changes: 42 additions & 5 deletions .github/workflows/ci_nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ on:
workflow_dispatch:
push:

env:
LIBYARA_TAG: v4.5.2-subreption

jobs:
build_linux:
runs-on: ubuntu-latest

strategy:
matrix:
jdk: [21]
libyara_tag: ["v4.5.2-subreption"]
libyara_tag: [ "${{ env.LIBYARA_TAG }}" ]

steps:
# Step 1: Checkout the repository
Expand Down Expand Up @@ -57,23 +60,41 @@ jobs:
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: [ "${{ env.LIBYARA_TAG }}" ]

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
Expand Down Expand Up @@ -121,6 +142,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 "<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
Expand Down Expand Up @@ -194,8 +231,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) - ${{ env.RELEASE_DATE }}
draft: false
prerelease: true
generate_release_notes: true
Expand Down
42 changes: 37 additions & 5 deletions .github/workflows/ci_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
- '*-stable-release'
workflow_dispatch:

env:
LIBYARA_TAG: v4.5.2-subreption

jobs:

build_linux64:
Expand All @@ -14,7 +17,7 @@ jobs:
strategy:
matrix:
jdk: [21]
libyara_tag: ["v4.5.2-subreption"]
libyara_tag: [ "${{ env.LIBYARA_TAG }}" ]
arch: [linux64]

steps:
Expand All @@ -30,7 +33,7 @@ jobs:
java-version: ${{ matrix.jdk }}
settings-path: ${{ github.workspace }}

- name: Clone libyara (${{ matrix.libyara_tag }})
- name: Clone libyara (${{ env.LIBYARA_TAG }})
uses: actions/checkout@v4
with:
repository: subreption/yara
Expand Down Expand Up @@ -61,6 +64,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 "<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 }}

- name: Cleanup
run: |
rm -rf ~/.m2/settings.xml
outputs:
linux-artifact: ${{ steps.build.outputs.maven-artifact }}

Expand All @@ -70,15 +85,15 @@ jobs:
strategy:
matrix:
jdk: [21]
libyara_tag: ["v4.5.2-subreption"]
libyara_tag: [ "${{ env.LIBYARA_TAG }}" ]
arch: [osx64]

steps:
- 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
Expand Down Expand Up @@ -126,6 +141,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 "<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 }}
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
Expand All @@ -138,6 +166,10 @@ jobs:
path: target/*-osx64.jar
overwrite: true

- name: Cleanup
run: |
rm -rf ~/.m2/settings.xml
outputs:
mac-artifact: ${{ steps.build.outputs.maven-artifact }}

Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit 5ef1cd6

Please sign in to comment.