Skip to content

Commit

Permalink
Merge pull request #30 from fluentci-io/feat/fluentci-engine-version
Browse files Browse the repository at this point in the history
feat: allow overriding the default FLUENTCI_ENGINE_VERSION to use
  • Loading branch information
tsirysndr authored Apr 9, 2024
2 parents 51cb654 + 037780b commit 2804f87
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 13 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.0
Version: 0.12.1

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.0";
version = "0.12.1";

src = ./.;
lockfile = "./deno.lock";
Expand Down
12 changes: 5 additions & 7 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

set -e -o pipefail

readonly MAGENTA="$(tput setaf 5 2>/dev/null || echo '')"
readonly GREEN="$(tput setaf 2 2>/dev/null || echo '')"
readonly CYAN="$(tput setaf 6 2>/dev/null || echo '')"
Expand Down Expand Up @@ -98,13 +100,9 @@ tar -xzf /tmp/$ASSET_NAME -C /tmp
chmod +x /tmp/fluentci

# Move the extracted binary to the installation directory
# use sudo if OS is Linux
if [ "$OS" = "Linux" ]; then
if command -v sudo >/dev/null 2>&1; then
sudo mv /tmp/fluentci $INSTALL_DIR
else
mv /tmp/fluentci $INSTALL_DIR
fi
# use sudo if available
if command -v sudo >/dev/null 2>&1; then
sudo mv /tmp/fluentci $INSTALL_DIR
else
mv /tmp/fluentci $INSTALL_DIR
fi
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.0";
export const VERSION = "0.12.1";

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

Expand Down
35 changes: 32 additions & 3 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,26 @@ async function installDagger() {
console.log("Dagger installed successfully");
}

export async function setupPkgx() {
Deno.env.set(
"PATH",
`${Deno.env.get("HOME")}/.local/bin:${Deno.env.get("PATH")}`
);
const command = new Deno.Command("bash", {
args: ["-c", `type pkgx >/dev/null 2>&1 || curl -Ssf https://pkgx.sh | sh`],
stdout: "inherit",
stderr: "inherit",
});

const process = await command.spawn();
const { code } = await process.status;

if (code !== 0) {
console.log("Failed to install pkgx.");
Deno.exit(1);
}
}

export async function setupRust() {
Deno.env.set(
"PATH",
Expand All @@ -194,6 +214,14 @@ export async function setupRust() {
}

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

if (!FLUENTCI_ENGINE_VERSION.startsWith("v")) {
FLUENTCI_ENGINE_VERSION = `v${FLUENTCI_ENGINE_VERSION}`;
}

Deno.env.set(
"PATH",
`${Deno.env.get("HOME")}/.local/bin:${Deno.env.get("PATH")}`
Expand All @@ -203,9 +231,10 @@ export async function setupFluentCIengine() {
args: [
"-c",
`\
type fluentci-engine >/dev/null 2>&1 || wget https://github.com/fluentci-io/fluentci-engine/releases/download/v0.2.5/fluentci-engine_v0.2.5_${target}.tar.gz;
type fluentci-engine >/dev/null 2>&1 || tar xvf fluentci-engine_v0.2.5_${target}.tar.gz;
type fluentci-engine >/dev/null 2>&1 || rm fluentci-engine_v0.2.5_${target}.tar.gz;
[ -n "$FLUENTCI_ENGINE_VERSION" ] && 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;
mkdir -p $HOME/.local/bin;
type fluentci-engine >/dev/null 2>&1 || mv fluentci-engine $HOME/.local/bin;`,
],
Expand Down

0 comments on commit 2804f87

Please sign in to comment.