Release Plugins #8
Workflow file for this run
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: Release Plugins | |
on: | |
push: | |
tags: | |
- '[0-9]+\.[0-9]+\.[0-9]+' | |
env: | |
OCI_REGISTRY: ghcr.io | |
PLUGIN_NAME: k8saudit-ovh | |
permissions: | |
contents: write | |
packages: write | |
jobs: | |
publish-oci-artifacts: | |
runs-on: ubuntu-latest | |
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 | |
uses: actions/checkout@v3 | |
with: | |
path: plugin | |
- name: Build the plugin | |
run: make build | |
working-directory: plugin | |
- id: StringRepoName | |
uses: ASzc/change-string-case-action@v5 | |
with: | |
string: ${{ github.repository }} | |
- name: Upload OCI artifacts to GitHub packages | |
run: | | |
MAJOR=$(echo ${{ github.ref_name }} | cut -f1 -d".") | |
MINOR=$(echo ${{ github.ref_name }} | cut -f1,2 -d".") | |
DIR=$(pwd) | |
cd plugin/ | |
$DIR/tools/falcoctl/falcoctl registry push \ | |
${{ env.OCI_REGISTRY }}/${{ steps.StringRepoName.outputs.lowercase }}/plugin/${{ env.PLUGIN_NAME }}:${{ github.ref_name }} \ | |
--config /dev/null \ | |
--type plugin \ | |
--version "${{ github.ref_name }}" \ | |
--tag latest --tag $MAJOR --tag $MINOR \ | |
--platform linux/amd64 \ | |
--requires plugin_api_version:2.0.0 \ | |
--name ${{ env.PLUGIN_NAME }} \ | |
lib${{ env.PLUGIN_NAME }}.so | |
env: | |
FALCOCTL_REGISTRY_AUTH_BASIC: ${{ env.OCI_REGISTRY }},${{ github.repository_owner }},${{ secrets.GITHUB_TOKEN }} | |
# Create signatures of the plugin artifacts as OCI artifacts | |
sign-oci-artifacts: | |
needs: [publish-oci-artifacts] | |
runs-on: ubuntu-latest | |
if: ${{ needs.publish-oci-artifacts.outputs.matrix != '[]' }} | |
strategy: | |
matrix: | |
value: ${{ fromJson(needs.publish-oci-artifacts.outputs.matrix) }} | |
permissions: | |
contents: read | |
id-token: write | |
packages: write | |
steps: | |
- name: Install Cosign | |
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 # v3.5.0 | |
- run: cosign version | |
- name: Log into ghcr.io | |
uses: docker/login-action@master | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Sign the artifacts with GitHub OIDC Token | |
run: cosign sign --yes ${{ matrix.value.repository.ref }}@${{ matrix.value.artifact.digest }} | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup Golang | |
uses: actions/setup-go@v3 | |
with: | |
go-version: '1.23' | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v6 | |
with: | |
# either 'goreleaser' (default) or 'goreleaser-pro' | |
distribution: goreleaser | |
# 'latest', 'nightly', or a semver | |
version: '~> v2' | |
args: release --clean | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
LDFLAGS: "-buildmode=c-shared" | |
GOPATH: /home/runner/go |