Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 564ce91

Browse files
committedFeb 27, 2024
bump v1.0.7
1 parent 0a94354 commit 564ce91

File tree

2 files changed

+48
-5
lines changed

2 files changed

+48
-5
lines changed
 

‎dist/index.js

+47-4
Original file line numberDiff line numberDiff line change
@@ -62763,6 +62763,14 @@ module.exports = require("net");
6276362763

6276462764
/***/ }),
6276562765

62766+
/***/ 7742:
62767+
/***/ ((module) => {
62768+
62769+
"use strict";
62770+
module.exports = require("node:process");
62771+
62772+
/***/ }),
62773+
6276662774
/***/ 2037:
6276762775
/***/ ((module) => {
6276862776

@@ -62969,11 +62977,45 @@ const tc = __nccwpck_require__(7784);
6296962977
const exec = __nccwpck_require__(1514);
6297062978
const cache = __nccwpck_require__(7799);
6297162979

62980+
const { platform } = __nccwpck_require__(7742);
62981+
const { arch } = __nccwpck_require__(7742);
62982+
62983+
function direnvBinaryURL(version, platform, arch) {
62984+
const baseurl = `https://github.com/direnv/direnv/releases/download/v${version}/direnv`
62985+
62986+
// supported arch: x64, arm64
62987+
// supported platform: linux, darwin
62988+
const supportedArch = ['x64', 'arm64'];
62989+
const supportedPlatform = ['linux', 'darwin'];
62990+
62991+
if (!supportedArch.includes(arch)) {
62992+
throw new Error(`unsupported arch: ${arch}`);
62993+
}
62994+
62995+
if (!supportedPlatform.includes(platform)) {
62996+
throw new Error(`unsupported platform: ${platform}`);
62997+
}
62998+
62999+
const archPlatform = `${platform}-${arch}`;
63000+
63001+
switch (archPlatform) {
63002+
case 'linux-x64':
63003+
return `${baseurl}.linux-amd64`;
63004+
case 'linux-arm64':
63005+
return `${baseurl}.linux-arm64`;
63006+
case 'darwin-x64':
63007+
return `${baseurl}.darwin-amd64`;
63008+
case 'darwin-arm64':
63009+
return `${baseurl}.darwin-arm64`;
63010+
default:
63011+
throw new Error(`unsupported platform: ${archPlatform}`);
63012+
}
63013+
}
6297263014

6297363015
// internal functions
6297463016
async function installTools() {
6297563017
const direnvVersion = core.getInput('direnvVersion');
62976-
core.info(`installing direnv-${direnvVersion}...`);
63018+
core.info(`installing direnv-${direnvVersion} on ${platform}-${arch}`);
6297763019

6297863020
// test direnv in cache
6297963021
const foundToolCache = tc.find('direnv', direnvVersion);
@@ -62982,7 +63024,7 @@ async function installTools() {
6298263024
core.addPath(foundToolCache);
6298363025
} else {
6298463026
const workspace = process.env['GITHUB_WORKSPACE'];
62985-
const key = `hatsunemiku3939-direnv-action-toolcache-${direnvVersion}`;
63027+
const key = `hatsunemiku3939-direnv-action-toolcache-${direnvVersion}-${platform}-${arch}`;
6298663028
const paths = [`${workspace}/.direnv-action`];
6298763029
const restoreKeys = [key];
6298863030

@@ -63002,8 +63044,9 @@ async function installTools() {
6300263044
// clear
6300363045
await exec.exec('rm', [`-rf`, `${workspace}/.direnv-action`]);
6300463046
} else {
63005-
core.info('direnv not found in cache, installing...');
63006-
const installPath = await tc.downloadTool(`https://github.com/direnv/direnv/releases/download/v${direnvVersion}/direnv.linux-amd64`);
63047+
const dlUrl = direnvBinaryURL(direnvVersion, platform, arch);
63048+
core.info(`direnv not found in cache, installing ${dlUrl} ...`);
63049+
const installPath = await tc.downloadTool(dlUrl);
6300763050

6300863051
// set permissions
6300963052
core.info(`direnv installed ${installPath}, setting permissions...`);

‎dist/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
Please sign in to comment.