Skip to content

Commit

Permalink
feat: add dagger-version input
Browse files Browse the repository at this point in the history
  • Loading branch information
tsirysndr committed Feb 14, 2024
1 parent 6bb4842 commit e07422f
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:
- uses: actions/checkout@v2
- name: Setup FluentCI
uses: ./
with:
dagger-version: 0.9.8
- name: Verify FluentCI
run: |
fluentci doctor || true
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: FluentCI
uses: fluentci-io/setup-fluentci@v3
uses: fluentci-io/setup-fluentci@v4
with:
dagger-version: 0.9.10
- name: Run Hello World
run: fluentci run base_pipeline
```
Expand Down
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ author: Tsiry Sandratraina
branding:
icon: play-circle
color: purple
inputs:
dagger-version:
description: Dagger version to install
required: false
default: 0.9.10
outputs:
version:
description: FluentCI CLI version installed
Expand Down
4 changes: 3 additions & 1 deletion dist/action.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import setup from "./setup.js";
if (!process.env.RUNNER_TEMP) {
process.env.RUNNER_TEMP = tmpdir();
}
setup()
setup({
daggerVersion: action.getInput("dagger-version"),
})
.then(({ version }) => {
action.setOutput("version", version);
})
Expand Down
4 changes: 2 additions & 2 deletions dist/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { join } from "node:path";
import * as action from "@actions/core";
import { getExecOutput, exec } from "@actions/exec";
import { installDocker } from "./setup-docker.js";
export default async () => {
export default async ({ daggerVersion, }) => {
// throw error on unsupported platforms (windows)
if (process.platform === "win32") {
throw new Error("FluentCI is not supported on Windows");
Expand All @@ -25,7 +25,7 @@ export default async () => {
]);
await exec("sh", [
"-c",
"curl -L https://dl.dagger.io/dagger/install.sh | DAGGER_VERSION=0.9.8 sh",
`curl -L https://dl.dagger.io/dagger/install.sh | DAGGER_VERSION=${daggerVersion} sh`,
]);
await exec("sudo", ["mv", "bin/dagger", "/usr/local/bin"]);
const version = await verifyFluentCI("fluentci");
Expand Down
4 changes: 3 additions & 1 deletion src/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ if (!process.env.RUNNER_TEMP) {
process.env.RUNNER_TEMP = tmpdir();
}

setup()
setup({
daggerVersion: action.getInput("dagger-version"),
})
.then(({ version }) => {
action.setOutput("version", version);
})
Expand Down
6 changes: 4 additions & 2 deletions src/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import * as action from "@actions/core";
import { getExecOutput, exec } from "@actions/exec";
import { installDocker } from "./setup-docker.js";

export default async (): Promise<{
export default async ({
daggerVersion,
}): Promise<{
version: string;
}> => {
// throw error on unsupported platforms (windows)
Expand Down Expand Up @@ -33,7 +35,7 @@ export default async (): Promise<{
]);
await exec("sh", [
"-c",
"curl -L https://dl.dagger.io/dagger/install.sh | DAGGER_VERSION=0.9.8 sh",
`curl -L https://dl.dagger.io/dagger/install.sh | DAGGER_VERSION=${daggerVersion} sh`,
]);

await exec("sudo", ["mv", "bin/dagger", "/usr/local/bin"]);
Expand Down

0 comments on commit e07422f

Please sign in to comment.