Skip to content

Commit

Permalink
Merge pull request #34 from fluentci-io/fix/wasm-publish
Browse files Browse the repository at this point in the history
fix: parse and use crate name from Cargo.toml
  • Loading branch information
tsirysndr authored Apr 10, 2024
2 parents b0c9e44 + f940035 commit f6e0311
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ fluentci # Run the pipeline
fluentci --help

Usage: fluentci [pipeline] [jobs...]
Version: 0.12.3
Version: 0.12.4

Description:

Expand Down
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

packages.default = pkgs.deno2nix.mkExecutable {
pname = "fluentci";
version = "0.12.3";
version = "0.12.4";

src = ./.;
lockfile = "./deno.lock";
Expand Down
8 changes: 7 additions & 1 deletion src/cmd/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,13 @@ const publishWasm = async () => {
const spinner = wait("Publishing package...").start();

const ls = new Deno.Command("bash", {
args: ["-c", "ls plugin/target/wasm32-unknown-unknown/release/*.wasm"],
args: [
"-c",
`ls plugin/target/wasm32-unknown-unknown/release/${cargoToml.package.name.replaceAll(
"-",
"_"
)}.wasm`,
],
stderr: "piped",
stdout: "piped",
});
Expand Down
21 changes: 18 additions & 3 deletions src/cmd/run.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import { BlobWriter, green, load, walk, ZipWriter, dayjs } from "../../deps.ts";
import {
BlobWriter,
green,
load,
walk,
ZipWriter,
dayjs,
toml,
} from "../../deps.ts";
import { BASE_URL, FLUENTCI_WS_URL, RUNNER_URL } from "../consts.ts";
import { getCommitInfos } from "../git.ts";
import {
Expand Down Expand Up @@ -402,11 +410,18 @@ const runWasmPlugin = async (pipeline: string, job: string[]) => {
});
await spawnCommand(build);

const cargoToml = toml.parse(
Deno.readTextFileSync(".fluentci/plugin/Cargo.toml")
// deno-lint-ignore no-explicit-any
) as Record<string, any>;

const command = new Deno.Command("bash", {
args: [
"-c",
"fluentci-engine call -m .fluentci/plugin/target/wasm32-unknown-unknown/release/*.wasm -- " +
job.join(" "),
`fluentci-engine call -m .fluentci/plugin/target/wasm32-unknown-unknown/release/${cargoToml.package.name.replaceAll(
"-",
"_"
)}.wasm -- ` + job.join(" "),
],
stdout: "inherit",
stderr: "inherit",
Expand Down
2 changes: 1 addition & 1 deletion src/consts.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { dir } from "../deps.ts";

export const VERSION = "0.12.3";
export const VERSION = "0.12.4";

export const BASE_URL = "https://api.fluentci.io/v1";

Expand Down

0 comments on commit f6e0311

Please sign in to comment.