Create encrypted rule package #47
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create encrypted rule package | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '30 20 * * *' | |
jobs: | |
zip-and-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
repository: 'Yamato-Security/hayabusa-rules' | |
- name: Extract directory | |
run: | | |
mkdir rules | |
mv ./config ./rules/ | |
mv ./hayabusa ./rules/ | |
mv ./sigma ./rules/ | |
- name: Zip directory | |
run: | | |
sudo apt-get install zip | |
zip -r -P yamato-security-hayabusa rules.zip ./rules | |
- name: Checkout self repository | |
uses: actions/checkout@v4 | |
with: | |
path: './self' | |
- name: Copy zip to self repository | |
run: | | |
cp ./rules.zip ./self | |
- name: Configure Git | |
run: | | |
cd ./self | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
- name: Commit changes | |
run: | | |
cd ./self | |
git add rules.zip | |
git commit -m "Automated update" | |
- name: Push changes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
cd ./self | |
if [ "$(git log -1 --pretty=%B)" = "Automated update" ]; then | |
git push origin main | |
fi |