Skip to content

Commit

Permalink
feat(workflow): add workflow to push rules in registry
Browse files Browse the repository at this point in the history
  • Loading branch information
Sarapuce committed Dec 29, 2023
1 parent cb89ca8 commit 9f9308e
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Release Rulesfile
on: push
jobs:

Release-Rulesfile:
runs-on: ubuntu-latest

permissions:
id-token: write
contents: read
packages: write

env:
# Only one ruleset file for our demo
RULESET_FILE: nsenter.yaml
# Used to setup Auth and OCI artifact location
OCI_REGISTRY: ghcr.io
# Assuming we are in the main branch, our OCI artifact will
# look something like ghcr.io/user/repo/custom-rules:main
OCI_ARTIFACT_NAME: custom-rules
OCI_ARTIFACT_VERSION: ${{ github.ref_name }}

steps:
- name: Checkout Falcoctl Repo
uses: actions/checkout@v3
with:
repository: falcosecurity/falcoctl
ref: main
path: tools/falcoctl

- name: Setup Golang
uses: actions/setup-go@v4
with:
go-version: '^1.20'
cache-dependency-path: tools/falcoctl/go.sum

- name: Build falcoctl
run: make
working-directory: tools/falcoctl

- name: Checkout Rules Repo
uses: actions/checkout@v3
with:
path: rules

- name: Upload OCI artifacts to GitHub packages
run: |
tools/falcoctl/falcoctl registry push \
--config /dev/null \
--type rulesfile \
--version ${OCI_ARTIFACT_VERSION} \
${OCI_REGISTRY}/${GITHUB_REPOSITORY}/${OCI_ARTIFACT_NAME}:${OCI_ARTIFACT_VERSION} \
rules/${RULESET_FILE}
env:
FALCOCTL_REGISTRY_AUTH_BASIC: ${{ env.OCI_REGISTRY }},${{ github.repository_owner }},${{ secrets.GITHUB_TOKEN }}

0 comments on commit 9f9308e

Please sign in to comment.