Skip to content

Commit

Permalink
Merge pull request #2 from LogCraftIO/feat/splunk-release
Browse files Browse the repository at this point in the history
feat: changes for splunk 0.1.0 release
  • Loading branch information
MatisseB authored Jun 24, 2024
2 parents ad32853 + 052875f commit 2c669b9
Show file tree
Hide file tree
Showing 12 changed files with 2,591 additions and 288 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
on:
push:
branches:
- main
pull_request:
branches:
- main

name: Checks

permissions:
contents: read

jobs:
licenses:
runs-on: ubuntu-latest
timeout-minutes: 10
env:
FORCE_COLOR: 1
steps:
- uses: actions/checkout@v4
- name: Check license headers
uses: korandoru/hawkeye@v5
93 changes: 93 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Release

permissions:
contents: write
pull-requests: write
attestations: write
id-token: write

on:
push:
tags:
- '**[0-9]+.[0-9]+.[0-9]+**'

jobs:
plan:
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
name: ${{ steps.name.outputs.name }}
version: ${{ steps.version.outputs.version }}
env:
TAG: ${{ github.ref_name }}
steps:
- name: Get plugin name
id: name
run: echo "name=${TAG%%-*}" >> $GITHUB_OUTPUT
- name: Get plugin version
id: version
run: echo "version=${TAG##*-}" >> $GITHUB_OUTPUT
build:
runs-on: ubuntu-latest
needs: plan
steps:
- name: GitHub Tag Name example
run: |
echo "Tag name from GITHUB_REF_NAME: $GITHUB_REF_NAME"
echo "Tag name from github.ref_name: ${{ github.ref_name }}"
- name: Checkout
uses: actions/checkout@v4
- uses: jcbhmr/setup-cargo-component@v1
- uses: Swatinem/rust-cache@v2
- name: Build
run: cargo component build --release -p ${{ needs.plan.outputs.name }}
- name: Attest
uses: actions/attest-build-provenance@v1
with:
subject-path: "target/wasm32-wasi/release/*.wasm"
- name: Archive built artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ needs.plan.outputs.name }}.wasm
if-no-files-found: error
path: |
target/wasm32-wasi/release/${{ needs.plan.outputs.name }}.wasm
release:
name: Create release
needs:
- plan
- build
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Fetch artifacts
uses: actions/download-artifact@v4
with:
name: ${{ needs.plan.outputs.name }}.wasm
path: release
- name: Generate checksum
working-directory: release
run: sha256sum ${{ needs.plan.outputs.name }}.wasm > ${{ needs.plan.outputs.name }}.wasm.sha256
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
name: ${{ needs.plan.outputs.name }} ${{ needs.plan.outputs.version }}
generate_release_notes: true
fail_on_unmatched_files: true
files: |
release/${{ needs.plan.outputs.name }}.wasm
release/${{ needs.plan.outputs.name }}.wasm.sha256
body: |
## Download lgc ${{ needs.plan.outputs.name }} - ${{ needs.plan.outputs.version }}
| File | Checksum |
|--------|----------|
|[${{ needs.plan.outputs.name }}.wasm](https://github.com/LogCraftIO/logcraft-cli-plugins/releases/download/${{ github.ref_name }}/${{ needs.plan.outputs.name }}.wasm) | [checksum](https://github.com/LogCraftIO/logcraft-cli-plugins/releases/download/${{ github.ref_name }}/${{ needs.plan.outputs.name }}.wasm) |
## Verifying GitHub Artifact Attestations
The artifacts in this release have attestations generated with GitHub Artifact Attestations. These can be verified by using the [GitHub CLI](https://cli.github.com/manual/gh_attestation_verify):
```sh
gh attestation verify <file-path of downloaded artifact> --repo LogCraftIO/logcraft-cli-plugins
```
49 changes: 49 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Release

permissions:
contents: write
pull-requests: write
attestations: write
id-token: write

on:
pull_request:

jobs:
changed-plugins:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.changed-plugins.outputs.all_changed_files }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: tj-actions/changed-files@v44
id: changed-plugins
with:
files: |
splunk/**
dir_names: 'true'
dir_names_max_depth: '1'
matrix: 'true'
- name: List all changed plugins
run: echo '${{ steps.changed-plugins.outputs.all_changed_files }}'

test:
runs-on: ubuntu-latest
needs: [changed-plugins]
strategy:
matrix:
package: ${{ fromJSON(needs.changed-plugins.outputs.matrix) }}
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- run: rustup toolchain install stable --profile minimal
- uses: jcbhmr/setup-cargo-component@v1
- uses: Swatinem/rust-cache@v2
- name: Build
run: cargo component build -p ${{ matrix.package }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.vscode/
target/
src/
**/src/bindings.rs
Loading

0 comments on commit 2c669b9

Please sign in to comment.