Skip to content

Commit 617811f

Browse files
authored
Copy generated mamba.bat to micromamba.bat to workaround cmd.exe Auto… (#234)
1 parent 4b9113a commit 617811f

File tree

5 files changed

+35
-10
lines changed

5 files changed

+35
-10
lines changed

dist/main.js

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

dist/post.js

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

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "setup-micromamba",
3-
"version": "1.11.0",
3+
"version": "2.0.0",
44
"private": true,
55
"description": "Action to setup micromamba",
66
"scripts": {

src/options.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ const inferOptions = (inputs: Inputs): Options => {
146146
// if micromambaUrl is specified, use that, otherwise use micromambaVersion (or 'latest' if not specified)
147147
const micromambaSource = inputs.micromambaUrl
148148
? right(inputs.micromambaUrl)
149-
: left(inputs.micromambaVersion || '1.5.10-0')
149+
: left(inputs.micromambaVersion || 'latest')
150150

151151
// we write to condarc if a condarc file is not already specified
152152
const writeToCondarc = inputs.condarcFile === undefined

src/shell-init.ts

+15
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ const removeMambaInitBlockFromBashProfile = () => {
3737
})
3838
}
3939

40+
const copyMambaBatToMicromambaBat = (options: Options) => {
41+
const mambaBat = path.join(options.micromambaRootPath, 'condabin', 'mamba.bat')
42+
const micromambaBat = path.join(options.micromambaRootPath, 'condabin', 'micromamba.bat')
43+
return fs.copyFile(mambaBat, micromambaBat)
44+
}
45+
4046
export const shellInit = (options: Options, shell: string) => {
4147
core.startGroup(`Initialize micromamba for ${shell}.`)
4248
const rootPrefixFlag = getRootPrefixFlagForInit(options)
@@ -52,6 +58,15 @@ export const shellInit = (options: Options, shell: string) => {
5258
if (os.platform() === 'linux' && shell === 'bash') {
5359
return command.then(copyMambaInitBlockToBashProfile).finally(core.endGroup)
5460
}
61+
62+
if (os.platform() === 'win32' && shell === 'cmd.exe') {
63+
return command
64+
.then(() => {
65+
return copyMambaBatToMicromambaBat(options)
66+
})
67+
.finally(core.endGroup)
68+
}
69+
5570
return command.finally(core.endGroup)
5671
}
5772

0 commit comments

Comments
 (0)