Skip to content

Commit

Permalink
feat: Build for release
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Aug 12, 2020
1 parent d7f8bd6 commit c5aa71c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 11 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
This action adds the [`conda`](https://conda.io/projects/conda/en/latest/user-guide/tasks/index.html)
command from the on the worker preinstalled miniconda version to the known shell commands.

:warning:
The usage directly from master (`s-weigand/setup-conda@master`) will be deprecated on 2020-07-01,
use tagged versions instead (i.e. `s-weigand/setup-conda@v1`). This is to ensure that breaking changes in this action, won't break users workflows.

## Inputs

| Name | Requirement | Default | Description |
Expand Down
2 changes: 1 addition & 1 deletion build.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"owner":"s-weigand","repo":"setup-conda","sha":"a49fa41ad2376642af89853a368c03bbf8efa230","ref":"refs/tags/v1.0.3","tagName":"v1.0.3","branch":"release","tags":["v1.0.3","v1"],"updated_at":"2020-05-06T09:38:21.487Z"}
{"owner":"s-weigand","repo":"setup-conda","sha":"bc0dbbad718fe8f5dde7ee9f0bff38c14b2f4d1c","ref":"refs/tags/v1.0.4","tagName":"v1.0.4","branch":"release","tags":["v1.0.4","v1"],"updated_at":"2020-08-12T22:33:41.497Z"}
34 changes: 24 additions & 10 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4776,6 +4776,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
Object.defineProperty(exports, "__esModule", { value: true });
const os = __importStar(__webpack_require__(87));
const path = __importStar(__webpack_require__(622));
const fs = __importStar(__webpack_require__(747));
const temp = __importStar(__webpack_require__(731));
const exec = __importStar(__webpack_require__(986));
const core = __importStar(__webpack_require__(470));
Expand All @@ -4792,20 +4793,34 @@ exports.setup_conda = (config) => __awaiter(this, void 0, void 0, function* () {
yield add_conda_channels(config);
yield update_conda(config);
yield install_python(config);
yield activate_conda(config);
yield reset_base_python(config, initialPythonLocation);
});
/**
* Generates the path of the bin dir of conda_dir.
* Only add path_to_add to the PATH variable if it exists
*
* @param path_to_add Path to add to the PATH variable
*/
const sane_add_path = (path_to_add) => {
if (fs.existsSync(path_to_add)) {
core.addPath(path_to_add);
}
};
/**
* Adds the bin dirs of default Python or Conda to Path
*
* @param conda_dir Root directory of the installed conda
* @param python_dist_dir Root directory of a Python dist dir
* @param config Configuration of the action
*/
const get_bin_dir = (conda_dir, config) => {
const add_bin_dir = (python_dist_dir, config) => {
if (config.os === 'win32') {
return path.join(conda_dir, 'Scripts');
sane_add_path(path.join(python_dist_dir, 'Scripts'));
sane_add_path(path.join(python_dist_dir, 'Library', 'bin'));
sane_add_path(path.join(python_dist_dir, 'usr', 'Library', 'bin'));
sane_add_path(path.join(python_dist_dir, 'mingw-w64', 'Library', 'bin'));
}
else {
return path.join(conda_dir, 'bin');
sane_add_path(path.join(python_dist_dir, 'bin'));
}
};
/**
Expand All @@ -4816,9 +4831,8 @@ const get_bin_dir = (conda_dir, config) => {
const addCondaToPath = (config) => __awaiter(this, void 0, void 0, function* () {
console.log(`Adding conda path to path: ${process.env.CONDA}`);
const conda_base_path = process.env.CONDA;
const bin_dir = get_bin_dir(conda_base_path, config);
core.addPath(conda_base_path);
core.addPath(bin_dir);
sane_add_path(conda_base_path);
add_bin_dir(conda_base_path, config);
});
/**
* Activates the conda base env.
Expand Down Expand Up @@ -4871,8 +4885,8 @@ const reset_base_python = (config, initialPythonLocation) => __awaiter(this, voi
}
console.log('Resetting Python to default version at:');
console.log(pythonLocation);
core.addPath(pythonLocation);
core.addPath(get_bin_dir(pythonLocation, config));
sane_add_path(pythonLocation);
add_bin_dir(pythonLocation, config);
}
});
/**
Expand Down

0 comments on commit c5aa71c

Please sign in to comment.