Skip to content

Commit

Permalink
Merge pull request #40 from fluentci-io/feat/install-latest-fluentci-…
Browse files Browse the repository at this point in the history
…engine

Install the latest version of fluentci-engine if FLUENTCI_ENGINE_VERSION is not set
  • Loading branch information
tsirysndr authored May 3, 2024
2 parents 990bd59 + fa3b454 commit f7ba93f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 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.13.0
Version: 0.13.1

Description:

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.13.0";
export const VERSION = "0.13.1";

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

Expand Down
22 changes: 19 additions & 3 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,24 @@ export async function setupRust() {

export async function setupFluentCIengine() {
await setupPkgx();
let FLUENTCI_ENGINE_VERSION =
Deno.env.get("FLUENTCI_ENGINE_VERSION") || "v0.2.5";
let FLUENTCI_ENGINE_VERSION = Deno.env.get("FLUENTCI_ENGINE_VERSION");

if (!FLUENTCI_ENGINE_VERSION) {
FLUENTCI_ENGINE_VERSION = await fetch(
"https://api.github.com/repos/fluentci-io/fluentci-engine/releases/latest"
)
.then((res) => res.json())
.then((data) => data.tag_name)
.catch(() => {
console.error("Failed to fetch latest release.");
Deno.exit(1);
});
}

if (!FLUENTCI_ENGINE_VERSION) {
console.error("Failed to fetch latest release.");
Deno.exit(1);
}

if (!FLUENTCI_ENGINE_VERSION.startsWith("v")) {
FLUENTCI_ENGINE_VERSION = `v${FLUENTCI_ENGINE_VERSION}`;
Expand All @@ -241,7 +257,7 @@ export async function setupFluentCIengine() {
args: [
"-c",
`\
[ -n "$FLUENTCI_ENGINE_VERSION" ] && type fluentci-engine >/dev/null 2>&1 && rm \`which fluentci-engine\`;
[ -n "$FORCE_FLUENTCI_ENGINE_INSTALL" ] && type fluentci-engine >/dev/null 2>&1 && rm \`which fluentci-engine\`;
type fluentci-engine >/dev/null 2>&1 || pkgx wget https://github.com/fluentci-io/fluentci-engine/releases/download/${FLUENTCI_ENGINE_VERSION}/fluentci-engine_${FLUENTCI_ENGINE_VERSION}_${target}.tar.gz;
type fluentci-engine >/dev/null 2>&1 || pkgx tar xvf fluentci-engine_${FLUENTCI_ENGINE_VERSION}_${target}.tar.gz;
type fluentci-engine >/dev/null 2>&1 || rm fluentci-engine_${FLUENTCI_ENGINE_VERSION}_${target}.tar.gz;
Expand Down

0 comments on commit f7ba93f

Please sign in to comment.