Update gh-pages. #375
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: Update gh-pages. | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * *' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sigma-rule-coverage | |
uses: actions/checkout@v4 | |
with: | |
path: sigma-rule-coverage | |
- name: Checkout sigma-rule-coverage (gh-phages) | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
ref: gh-pages | |
path: sigma-rule-coverage-gh-pages | |
- name: Checkout sigma | |
uses: actions/checkout@v4 | |
with: | |
repository: SigmaHQ/sigma | |
path: sigma | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.10" | |
- name: Install Poetry | |
uses: abatilo/actions-poetry@v2.0.0 | |
with: | |
poetry-version: "1.7.1" | |
- name: Install | |
working-directory: sigma-rule-coverage | |
run: poetry install | |
- name: Build | |
working-directory: sigma-rule-coverage | |
run: | | |
# Activate poetry shell from sigma-rule-coverage in this shell | |
. $(poetry env info --path)/bin/activate | |
# Copy rules | |
chmod +x $GITHUB_WORKSPACE/sigma-rule-coverage/rule-coverage.py | |
$GITHUB_WORKSPACE/sigma-rule-coverage/rule-coverage.py --rules "$GITHUB_WORKSPACE/sigma/rules" --output "$GITHUB_WORKSPACE/sigma-rule-coverage-gh-pages/data/model.json" | |
- name: Push | |
working-directory: sigma-rule-coverage-gh-pages | |
run: | | |
# Prepare Git environment | |
git config --global user.email "github.action@localhost.local" | |
git config --global user.name "CI" | |
# Git add and commit. | |
git add . | |
git commit -m "Updated model.json" || true | |
git config --global --add --bool push.autoSetupRemote true || true | |
git push |