GitHub Workflow Example
name: Publish Rules
permissions:
contents: read
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch: {}
env:
IMAGE: gombocai/orl:latest
RULE_SERVICE_URL: https://rules.app.gomboc.ai
RULE_SERVICE_TOKEN: ${{ secrets.RULE_SERVICE_TOKEN}}
jobs:
push-rules:
name: Push Rules to Rules Service
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Pull Docker Image
run: docker pull ${{ env.IMAGE }}
- name: Validate Rulespace
run: |
docker run --rm \
-v ${{ github.workspace }}:/workspace \
-w /workspace \
${{ env.IMAGE }} \
walk rulespace ./final/rules
- name: Update Channels and Classifications
if: github.event_name != 'pull_request'
run: |
./bin/rules-service upsert channels ./final/channels
./bin/rules-service upsert classifications ./final/classifications
- name: Push Rules to Rules Service
if: github.event_name != 'pull_request'
env:
RULE_SERVICE_URL: ${{ env.RULE_SERVICE_URL }}
RULE_SERVICE_TOKEN: ${{ env.RULE_SERVICE_TOKEN }}
run: |
docker run --rm \
-v ${{ github.workspace }}:/workspace \
-w /workspace \
-e RULE_SERVICE_URL=$RULE_SERVICE_URL \
-e RULE_SERVICE_TOKEN=$RULE_SERVICE_TOKEN \
${{ env.IMAGE }} \
rules push --url "$RULE_SERVICE_URL" --token "$RULE_SERVICE_TOKEN" ./final/rules
- name: Delete Old Channels, Classifications, and Rules
if: github.event_name != 'pull_request'
run: |
./bin/rules-service delete channels ./final/channels
./bin/rules-service delete classifications ./final/classifications
./bin/rules-service delete rules ./final/rulesLast updated