@@ -62763,6 +62763,14 @@ module.exports = require("net");
62763
62763
62764
62764
/***/ }),
62765
62765
62766
+ /***/ 7742:
62767
+ /***/ ((module) => {
62768
+
62769
+ "use strict";
62770
+ module.exports = require("node:process");
62771
+
62772
+ /***/ }),
62773
+
62766
62774
/***/ 2037:
62767
62775
/***/ ((module) => {
62768
62776
@@ -62969,11 +62977,45 @@ const tc = __nccwpck_require__(7784);
62969
62977
const exec = __nccwpck_require__(1514);
62970
62978
const cache = __nccwpck_require__(7799);
62971
62979
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
+ }
62972
63014
62973
63015
// internal functions
62974
63016
async function installTools() {
62975
63017
const direnvVersion = core.getInput('direnvVersion');
62976
- core.info(`installing direnv-${direnvVersion}... `);
63018
+ core.info(`installing direnv-${direnvVersion} on ${platform}-${arch} `);
62977
63019
62978
63020
// test direnv in cache
62979
63021
const foundToolCache = tc.find('direnv', direnvVersion);
@@ -62982,7 +63024,7 @@ async function installTools() {
62982
63024
core.addPath(foundToolCache);
62983
63025
} else {
62984
63026
const workspace = process.env['GITHUB_WORKSPACE'];
62985
- const key = `hatsunemiku3939-direnv-action-toolcache-${direnvVersion}`;
63027
+ const key = `hatsunemiku3939-direnv-action-toolcache-${direnvVersion}-${platform}-${arch} `;
62986
63028
const paths = [`${workspace}/.direnv-action`];
62987
63029
const restoreKeys = [key];
62988
63030
@@ -63002,8 +63044,9 @@ async function installTools() {
63002
63044
// clear
63003
63045
await exec.exec('rm', [`-rf`, `${workspace}/.direnv-action`]);
63004
63046
} 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);
63007
63050
63008
63051
// set permissions
63009
63052
core.info(`direnv installed ${installPath}, setting permissions...`);
0 commit comments