Skip to content

Commit

Permalink
ci(yara): use a different value for the cache key than the inter-job …
Browse files Browse the repository at this point in the history
…artifact name

Signed-off-by: Siddhesh Mhadnak <[email protected]>
  • Loading branch information
sid-maddy committed Feb 18, 2024
1 parent 776f6bc commit 553b84c
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions .github/workflows/yara.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: YARA

on:
Expand All @@ -9,7 +10,7 @@ on:
type: string
version:
description: YARA version
default: "4.3.1"
default: 4.3.1
required: false
type: string
outputs:
Expand All @@ -23,26 +24,38 @@ on:
description: YARA Library Path
value: .libs

defaults:
run:
shell: bash

jobs:
yara:
runs-on: ${{ inputs.runs-on }}
steps:
- name: Cache YARA
id: cache-yara
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
with:
key: yara-${{ inputs.version }}-${{ runner.os }}-${{ runner.arch }}
key: yara-cache-${{ inputs.version }}-${{ runner.os }}-${{ runner.arch }}
path: yara-${{ inputs.version }}

- name: Compile YARA
if: steps.cache-yara.outputs.cache-hit != 'true' && runner.os == 'Linux'
run: |
#/usr/bin/env bash
set -e
curl -sL https://github.com/VirusTotal/yara/archive/refs/tags/v${{ inputs.version }}.tar.gz -o yara-${{ inputs.version }}.tar.gz
tar -xzf yara-${{ inputs.version }}.tar.gz && cd yara-${{ inputs.version }} && ./bootstrap.sh && ./configure && make
curl -sL \
https://github.com/VirusTotal/yara/archive/refs/tags/v${{ inputs.version }}.tar.gz \
-o yara-${{ inputs.version }}.tar.gz
tar -xzf yara-${{ inputs.version }}.tar.gz
cd yara-${{ inputs.version }}
./bootstrap.sh
./configure
make
if: steps.cache-yara.outputs.cache-hit != 'true' && runner.os == 'Linux'

- name: Upload YARA
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
if-no-files-found: error
name: yara-${{ inputs.version }}-${{ runner.os }}-${{ runner.arch }}
Expand Down

0 comments on commit 553b84c

Please sign in to comment.