Skip to content
Permalink
master
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
import * as core from "@actions/core";
import * as tc from "@actions/tool-cache";
import * as path from "path";
const isWin = /^win/.test(process.platform);
const isMac = process.platform === "darwin";
export const dartOS = isWin ? "windows" : (isMac ? "macos" : "linux");
async function run() {
try {
const dartChannel = core.getInput("channel", { required: true });
const releaseType = dartChannel === "be" ? "raw" : "release";
const url = `https://storage.googleapis.com/dart-archive/channels/${dartChannel}/${releaseType}/latest/sdk/dartsdk-${dartOS}-x64-release.zip`;
const dartZipPath = await tc.downloadTool(url);
// TODO: Cache?
// https://github.com/actions/toolkit/tree/master/packages/tool-cache
const dartSdkPath = await tc.extractZip(dartZipPath);
core.addPath(path.join(dartSdkPath, "dart-sdk", "bin"));
core.setOutput("dart-sdk", dartSdkPath);
} catch (error) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
core.setFailed(error?.message || error);
}
}
void run();