From f098ba5871a35e6ba9650985d65a5945bbc62374 Mon Sep 17 00:00:00 2001 From: Miles Johnson Date: Sun, 10 May 2026 12:02:53 -0700 Subject: [PATCH 1/3] Add example tool. --- .moon/workspace.yml | 1 + Cargo.lock | 10 ++++++++++ scripts/publish.mjs | 2 +- tools/example/CHANGELOG.md | 7 +++++++ tools/example/Cargo.toml | 28 ++++++++++++++++++++++++++++ tools/example/README.md | 3 +++ tools/example/src/lib.rs | 5 +++++ tools/example/src/proto.rs | 15 +++++++++++++++ 8 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 tools/example/CHANGELOG.md create mode 100644 tools/example/Cargo.toml create mode 100644 tools/example/README.md create mode 100644 tools/example/src/lib.rs create mode 100644 tools/example/src/proto.rs diff --git a/.moon/workspace.yml b/.moon/workspace.yml index e8572d47..3b4b46a4 100644 --- a/.moon/workspace.yml +++ b/.moon/workspace.yml @@ -14,6 +14,7 @@ projects: # Tools bun-tool: tools/bun deno-tool: tools/deno + example-tool: tools/example go-tool: tools/go moon-tool: tools/moon node-tool: tools/node diff --git a/Cargo.lock b/Cargo.lock index 9ea75fd7..bb79085d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1446,6 +1446,16 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "example_tool" +version = "0.0.0" +dependencies = [ + "extism-pdk", + "proto_pdk", + "serde", + "tool_common", +] + [[package]] name = "extension_common" version = "0.1.1" diff --git a/scripts/publish.mjs b/scripts/publish.mjs index 76281416..40d1df8f 100644 --- a/scripts/publish.mjs +++ b/scripts/publish.mjs @@ -76,7 +76,7 @@ for (let pkg of packages) { annosPath, "--artifact-type", "application/wasm", - `ghcr.io/moonrepo/${pkg.name}:${pkg.version}`, + `ghcr.io/moonrepo/${pkg.name}:${pkg.version},latest`, `${wasmFile}:application/wasm`, ]; diff --git a/tools/example/CHANGELOG.md b/tools/example/CHANGELOG.md new file mode 100644 index 00000000..7f1c5396 --- /dev/null +++ b/tools/example/CHANGELOG.md @@ -0,0 +1,7 @@ +# Changelog + +## Unreleased + +#### 🎉 Release + +- Initial release! diff --git a/tools/example/Cargo.toml b/tools/example/Cargo.toml new file mode 100644 index 00000000..aabbb998 --- /dev/null +++ b/tools/example/Cargo.toml @@ -0,0 +1,28 @@ +[package] +name = "example_tool" +version = "0.0.0" +edition = "2024" +description = "Example tool." +authors = ["Miles Johnson"] +license = "MIT" +repository = "https://github.com/moonrepo/plugins" +documentation = "https://github.com/moonrepo/plugins/tree/master/tools/example" +publish = false + +[package.metadata.release] +pre-release-replacements = [ + { file = "./CHANGELOG.md", search = "Unreleased", replace = "{{version}}" }, +] + +[lib] +crate-type = ["cdylib"] + +[dependencies] +tool_common = { path = "../../crates/tool-common" } +extism-pdk = { workspace = true } +proto_pdk = { workspace = true } +serde = { workspace = true } + +[features] +default = ["wasm"] +wasm = [] diff --git a/tools/example/README.md b/tools/example/README.md new file mode 100644 index 00000000..f1916357 --- /dev/null +++ b/tools/example/README.md @@ -0,0 +1,3 @@ +# example plugin + +An example plugin for testing our systems. diff --git a/tools/example/src/lib.rs b/tools/example/src/lib.rs new file mode 100644 index 00000000..8ec81333 --- /dev/null +++ b/tools/example/src/lib.rs @@ -0,0 +1,5 @@ +#[cfg(feature = "wasm")] +mod proto; + +#[cfg(feature = "wasm")] +pub use proto::*; diff --git a/tools/example/src/proto.rs b/tools/example/src/proto.rs new file mode 100644 index 00000000..15280a48 --- /dev/null +++ b/tools/example/src/proto.rs @@ -0,0 +1,15 @@ +use extism_pdk::*; +use proto_pdk::*; +use tool_common::enable_tracing; + +#[plugin_fn] +pub fn register_tool(Json(_): Json) -> FnResult> { + enable_tracing(); + + Ok(Json(RegisterToolOutput { + name: "Example".into(), + type_of: PluginType::CommandLine, + plugin_version: Version::parse(env!("CARGO_PKG_VERSION")).ok(), + ..RegisterToolOutput::default() + })) +} From f3c45d2d53ef90cfc48969df5eba64a812df57ae Mon Sep 17 00:00:00 2001 From: Miles Johnson Date: Sun, 10 May 2026 12:50:47 -0700 Subject: [PATCH 2/3] Update workflow. --- .github/workflows/ci.yml | 10 +++++----- .github/workflows/release.yml | 11 ++++++++++- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4778bc32..b3d460c7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: # os: [ubuntu-latest, windows-latest] # fail-fast: false # steps: - # - uses: actions/checkout@v4 + # - uses: actions/checkout@v6 # - uses: moonrepo/setup-rust@v1 # with: # cache: false @@ -35,7 +35,7 @@ jobs: # os: [ubuntu-latest, windows-latest] # fail-fast: false # steps: - # - uses: actions/checkout@v4 + # - uses: actions/checkout@v6 # - uses: moonrepo/setup-rust@v1 # with: # cache: false @@ -49,7 +49,7 @@ jobs: # os: [ubuntu-latest, macos-latest, windows-latest] # fail-fast: false # steps: - # - uses: actions/checkout@v4 + # - uses: actions/checkout@v6 # - uses: moonrepo/setup-rust@v1 # with: # bins: cargo-nextest @@ -66,7 +66,7 @@ jobs: job-total: ${{ steps.plan.outputs.job-total }} jobs-array: ${{ steps.plan.outputs.jobs-array }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: fetch-depth: 0 - uses: moonrepo/setup-toolchain@v0 @@ -85,7 +85,7 @@ jobs: job: ${{ fromJson(needs.plan.outputs.jobs-array) }} fail-fast: false steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: fetch-depth: 0 - uses: moonrepo/setup-toolchain@v0 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f3800fb7..a2720d91 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,7 +1,12 @@ name: Release permissions: + # Releases contents: write + # Packages + packages: write + attestations: write + id-token: write on: push: @@ -14,12 +19,16 @@ jobs: name: Build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - uses: moonrepo/setup-rust@v1 with: cache: false - id: build uses: moonrepo/build-wasm-plugin@v0 + with: + publish: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }} uses: ncipollo/release-action@v1 with: From 6caa1b76a4d04ac8da87c5c609f4fb82251893b5 Mon Sep 17 00:00:00 2001 From: Miles Johnson Date: Sun, 10 May 2026 13:45:58 -0700 Subject: [PATCH 3/3] Only publish on tag. --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a2720d91..87ae6629 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,7 +26,7 @@ jobs: - id: build uses: moonrepo/build-wasm-plugin@v0 with: - publish: true + publish: ${{ github.event_name == 'push' && github.ref_type == 'tag' }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }}