-
Notifications
You must be signed in to change notification settings - Fork 18
131 lines (112 loc) · 3.75 KB
/
weekly-release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
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 CMake and Ninja
run: sudo apt-get install -y cmake ninja-build
- 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