Skip to content

Commit f7ba93f

Browse files
authored
Merge pull request #40 from fluentci-io/feat/install-latest-fluentci-engine
Install the latest version of fluentci-engine if FLUENTCI_ENGINE_VERSION is not set
2 parents 990bd59 + fa3b454 commit f7ba93f

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ fluentci # Run the pipeline
8080
fluentci --help
8181

8282
Usage: fluentci [pipeline] [jobs...]
83-
Version: 0.13.0
83+
Version: 0.13.1
8484

8585
Description:
8686

src/consts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { dir } from "../deps.ts";
22

3-
export const VERSION = "0.13.0";
3+
export const VERSION = "0.13.1";
44

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

src/utils.ts

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,24 @@ export async function setupRust() {
225225

226226
export async function setupFluentCIengine() {
227227
await setupPkgx();
228-
let FLUENTCI_ENGINE_VERSION =
229-
Deno.env.get("FLUENTCI_ENGINE_VERSION") || "v0.2.5";
228+
let FLUENTCI_ENGINE_VERSION = Deno.env.get("FLUENTCI_ENGINE_VERSION");
229+
230+
if (!FLUENTCI_ENGINE_VERSION) {
231+
FLUENTCI_ENGINE_VERSION = await fetch(
232+
"https://api.github.com/repos/fluentci-io/fluentci-engine/releases/latest"
233+
)
234+
.then((res) => res.json())
235+
.then((data) => data.tag_name)
236+
.catch(() => {
237+
console.error("Failed to fetch latest release.");
238+
Deno.exit(1);
239+
});
240+
}
241+
242+
if (!FLUENTCI_ENGINE_VERSION) {
243+
console.error("Failed to fetch latest release.");
244+
Deno.exit(1);
245+
}
230246

231247
if (!FLUENTCI_ENGINE_VERSION.startsWith("v")) {
232248
FLUENTCI_ENGINE_VERSION = `v${FLUENTCI_ENGINE_VERSION}`;
@@ -241,7 +257,7 @@ export async function setupFluentCIengine() {
241257
args: [
242258
"-c",
243259
`\
244-
[ -n "$FLUENTCI_ENGINE_VERSION" ] && type fluentci-engine >/dev/null 2>&1 && rm \`which fluentci-engine\`;
260+
[ -n "$FORCE_FLUENTCI_ENGINE_INSTALL" ] && type fluentci-engine >/dev/null 2>&1 && rm \`which fluentci-engine\`;
245261
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;
246262
type fluentci-engine >/dev/null 2>&1 || pkgx tar xvf fluentci-engine_${FLUENTCI_ENGINE_VERSION}_${target}.tar.gz;
247263
type fluentci-engine >/dev/null 2>&1 || rm fluentci-engine_${FLUENTCI_ENGINE_VERSION}_${target}.tar.gz;

0 commit comments

Comments
 (0)