Skip to content

Weekly Release

Weekly Release #83

name: Weekly Release
permissions:
contents: write
on:
schedule:
- cron: '0 0 * * 0' # Runs at 00:00 every Sunday
workflow_dispatch:
jobs:
create-release:
runs-on: ubuntu-latest
steps:
- name: Check out repository with submodules
uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Install RE2
run: sudo apt-get install -y libre2-dev
- name: Install dependencies for yaraQA
run: |
python -m pip install --upgrade pip
if [ -f qa/yaraQA/requirements.txt ]; then pip install -r qa/yaraQA/requirements.txt; fi
- name: Run YARA-Forge
run: |
python yara-forge.py
- name: Get current date
run: echo "CURRENT_DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV
shell: bash
- name: Zip and upload packages
run: |
for folder in packages/*; do
if [ -d "$folder" ]; then
foldername=$(basename "$folder")
zipfile="yara-forge-rules-${foldername}.zip"
zip -r "$zipfile" "$folder"
echo "${foldername}_zip_path=${zipfile}" >> zip_paths.env
fi
done
id: zip_files
shell: bash
- name: Set zip paths as env
run: cat zip_paths.env >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.CURRENT_DATE }}
release_name: YARA Forge Rule Set Release ${{ env.CURRENT_DATE }}
body_path: build_stats.md
draft: false
prerelease: false
- name: Upload build log file
if: always()
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: yara-forge.log
asset_name: yara-forge-log.txt
asset_content_type: text/plain
- name: Upload rule issues log file
if: always()
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: yara-forge-rule-issues.yml
asset_name: yara-forge-rule-issues.yml
asset_content_type: text/plain
- name: Upload core asset
if: always()
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.core_zip_path }}
asset_name: yara-forge-rules-core.zip
asset_content_type: application/zip
- name: Upload extended asset
if: always()
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.extended_zip_path }}
asset_name: yara-forge-rules-extended.zip
asset_content_type: application/zip
- name: Upload full asset
if: always()
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.full_zip_path }}
asset_name: yara-forge-rules-full.zip
asset_content_type: application/zip