9 Commits
v1.4 ... v1.5.0

Author SHA1 Message Date
Jonathan Clem
3c118cec41 v1.5.0 2020-11-17 08:29:07 -05:00
Jonathan Clem
96441ef64f Merge pull request #46 from deniskulicek/parametrize-otp-os-version
Fetch OTP release based on ImageOS environment variable
2020-11-17 08:26:49 -05:00
Denis Kulicek
6c1b312521 Update action.yml description 2020-10-29 14:30:42 +01:00
Denis Kulicek
2e57bfa4c5 Update action.yml with experimental-otp input 2020-10-29 14:28:26 +01:00
Denis Kulicek
7b728b73d0 Add experimental-otp input opt-in flag 2020-10-29 14:27:52 +01:00
Denis Kulicek
d114e80cc4 Add osVersion parameter based on ImageOS env variable 2020-10-28 16:20:42 +01:00
Jonathan Clem
584173361f Merge pull request #44 from thboop/main
Swap to Environment Files
2020-09-29 12:02:50 -04:00
Thomas Boop
9a85e287d8 update licenses 2020-09-29 10:39:10 -04:00
Thomas Boop
5849652165 Swap to Environment Files 2020-09-29 10:38:38 -04:00
12 changed files with 158 additions and 68 deletions

View File

@@ -1,30 +0,0 @@
---
name: "@actions/core"
version: 1.2.4
type: npm
summary: Actions core lib
homepage: https://github.com/actions/toolkit/tree/master/packages/core
license: mit
licenses:
- sources: Auto-generated MIT license text
text: |
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
notices: []

View File

@@ -0,0 +1,20 @@
---
name: "@actions/core"
version: 1.2.6
type: npm
summary: Actions core lib
homepage: https://github.com/actions/toolkit/tree/main/packages/core
license: mit
licenses:
- sources: LICENSE.md
text: |-
The MIT License (MIT)
Copyright 2019 GitHub
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
notices: []

View File

@@ -9,6 +9,9 @@ inputs:
description: Version range or exact version of Elixir to use
otp-version:
description: Version range or exact version of OTP to use
experimental-otp:
description: Whether to use experimental builds of OTP (images that have not yet been fully tested include ubuntu-16.04, ubuntu-18.04, ubuntu-20.04)
default: false
install-hex:
description: Whether to install Hex
default: true

127
dist/index.js vendored
View File

@@ -650,6 +650,32 @@ class ExecState extends events.EventEmitter {
/***/ }),
/***/ 82:
/***/ (function(__unusedmodule, exports) {
"use strict";
// We use any as a valid input type
/* eslint-disable @typescript-eslint/no-explicit-any */
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Sanitizes an input into a string so it can be passed into issueCommand safely
* @param input input to sanitize into a string
*/
function toCommandValue(input) {
if (input === null || input === undefined) {
return '';
}
else if (typeof input === 'string' || input instanceof String) {
return input;
}
return JSON.stringify(input);
}
exports.toCommandValue = toCommandValue;
//# sourceMappingURL=utils.js.map
/***/ }),
/***/ 87:
/***/ (function(module) {
@@ -657,6 +683,42 @@ module.exports = require("os");
/***/ }),
/***/ 102:
/***/ (function(__unusedmodule, exports, __webpack_require__) {
"use strict";
// For internal use, subject to change.
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
// We use any as a valid input type
/* eslint-disable @typescript-eslint/no-explicit-any */
const fs = __importStar(__webpack_require__(747));
const os = __importStar(__webpack_require__(87));
const utils_1 = __webpack_require__(82);
function issueCommand(command, message) {
const filePath = process.env[`GITHUB_${command}`];
if (!filePath) {
throw new Error(`Unable to find environment variable for file command ${command}`);
}
if (!fs.existsSync(filePath)) {
throw new Error(`Missing file at path: ${filePath}`);
}
fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {
encoding: 'utf8'
});
}
exports.issueCommand = issueCommand;
//# sourceMappingURL=file-command.js.map
/***/ }),
/***/ 129:
/***/ (function(module) {
@@ -2794,6 +2856,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
};
Object.defineProperty(exports, "__esModule", { value: true });
const os = __importStar(__webpack_require__(87));
const utils_1 = __webpack_require__(82);
/**
* Commands
*
@@ -2847,28 +2910,14 @@ class Command {
return cmdStr;
}
}
/**
* Sanitizes an input into a string so it can be passed into issueCommand safely
* @param input input to sanitize into a string
*/
function toCommandValue(input) {
if (input === null || input === undefined) {
return '';
}
else if (typeof input === 'string' || input instanceof String) {
return input;
}
return JSON.stringify(input);
}
exports.toCommandValue = toCommandValue;
function escapeData(s) {
return toCommandValue(s)
return utils_1.toCommandValue(s)
.replace(/%/g, '%25')
.replace(/\r/g, '%0D')
.replace(/\n/g, '%0A');
}
function escapeProperty(s) {
return toCommandValue(s)
return utils_1.toCommandValue(s)
.replace(/%/g, '%25')
.replace(/\r/g, '%0D')
.replace(/\n/g, '%0A')
@@ -2906,9 +2955,9 @@ async function installElixir(version, otpMajor) {
*
* @param {string} version
*/
async function installOTP(version) {
async function installOTP(version, osVersion) {
if (process.platform === 'linux') {
await exec(__webpack_require__.ab + "install-otp", [version])
await exec(__webpack_require__.ab + "install-otp", [version, osVersion])
return
}
@@ -2943,6 +2992,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
};
Object.defineProperty(exports, "__esModule", { value: true });
const command_1 = __webpack_require__(431);
const file_command_1 = __webpack_require__(102);
const utils_1 = __webpack_require__(82);
const os = __importStar(__webpack_require__(87));
const path = __importStar(__webpack_require__(622));
/**
@@ -2969,9 +3020,17 @@ var ExitCode;
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function exportVariable(name, val) {
const convertedVal = command_1.toCommandValue(val);
const convertedVal = utils_1.toCommandValue(val);
process.env[name] = convertedVal;
command_1.issueCommand('set-env', { name }, convertedVal);
const filePath = process.env['GITHUB_ENV'] || '';
if (filePath) {
const delimiter = '_GitHubActionsFileCommandDelimeter_';
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
file_command_1.issueCommand('ENV', commandValue);
}
else {
command_1.issueCommand('set-env', { name }, convertedVal);
}
}
exports.exportVariable = exportVariable;
/**
@@ -2987,7 +3046,13 @@ exports.setSecret = setSecret;
* @param inputPath
*/
function addPath(inputPath) {
command_1.issueCommand('add-path', {}, inputPath);
const filePath = process.env['GITHUB_PATH'] || '';
if (filePath) {
file_command_1.issueCommand('PATH', inputPath);
}
else {
command_1.issueCommand('add-path', {}, inputPath);
}
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
}
exports.addPath = addPath;
@@ -3259,11 +3324,16 @@ async function main() {
let installHex = core.getInput('install-hex')
installHex = installHex == null ? 'true' : installHex
let installRebar = core.getInput('install-rebar')
installRebar = installRebar == null ? 'true' : installRebar
console.log(`##[group]Installing OTP ${otpVersion}`)
await installOTP(otpVersion)
const experimentalOTP = core.getInput('experimental-otp')
const osVersion =
experimentalOTP === 'true' ? getRunnerOSVersion() : 'ubuntu-14.04'
console.log(`##[group]Installing OTP ${otpVersion} - built on ${osVersion}`)
await installOTP(otpVersion, osVersion)
console.log(`##[endgroup]`)
console.log(`##[group]Installing Elixir ${elixirVersion}`)
@@ -3279,6 +3349,7 @@ async function main() {
console.log(`##[add-matcher]${path.join(matchersPath, 'elixir.json')}`)
core.setOutput('otp-version', otpVersion)
core.setOutput('elixir-version', elixirVersion)
core.setOutput('osVersion', osVersion)
}
function checkPlatform() {
@@ -3292,6 +3363,16 @@ async function getOtpVersion(spec) {
return getVersionFromSpec(spec, await getOtpVersions()) || spec
}
function getRunnerOSVersion(experimentalOTP) {
const mapToUbuntuVersion = {
ubuntu16: 'ubuntu-16.04',
ubuntu18: 'ubuntu-18.04',
ubuntu20: 'ubuntu-20.04',
}
return mapToUbuntuVersion[process.env.ImageOS] || 'ubuntu-18.04'
}
exports.getElixirVersion = getElixirVersion
async function getElixirVersion(spec, otpVersion) {

2
dist/install-elixir vendored
View File

@@ -7,4 +7,4 @@ cd $RUNNER_TEMP
wget -q https://repo.hex.pm/builds/elixir/${1}${2}.zip
unzip -d .setup-elixir/elixir ${1}${2}.zip
rm ${1}${2}.zip
echo "::add-path::$(pwd)/.setup-elixir/elixir/bin"
echo "$(pwd)/.setup-elixir/elixir/bin" >> $GITHUB_PATH

4
dist/install-otp vendored
View File

@@ -4,9 +4,9 @@ set -eo pipefail
cd $RUNNER_TEMP
wget -q -O otp.tar.gz https://repo.hex.pm/builds/otp/ubuntu-14.04/OTP-${1}.tar.gz
wget -q -O otp.tar.gz https://repo.hex.pm/builds/otp/${2}/OTP-${1}.tar.gz
mkdir -p .setup-elixir/otp
tar zxf otp.tar.gz -C .setup-elixir/otp --strip-components=1
rm otp.tar.gz
.setup-elixir/otp/Install -minimal $(pwd)/.setup-elixir/otp
echo "::add-path::$(pwd)/.setup-elixir/otp/bin"
echo "$(pwd)/.setup-elixir/otp/bin" >> $GITHUB_PATH

8
package-lock.json generated
View File

@@ -1,13 +1,13 @@
{
"name": "setup-elixir",
"version": "1.4.1",
"version": "1.5.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@actions/core": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.4.tgz",
"integrity": "sha512-YJCEq8BE3CdN8+7HPZ/4DxJjk/OkZV2FFIf+DlZTC/4iBlzYCD5yjRR6eiOS5llO11zbRltIRuKAjMKaWTE6cg=="
"version": "1.2.6",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.6.tgz",
"integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA=="
},
"@actions/exec": {
"version": "1.0.4",

View File

@@ -1,6 +1,6 @@
{
"name": "setup-elixir",
"version": "1.4.1",
"version": "1.5.0",
"license": "MIT",
"private": true,
"scripts": {

View File

@@ -7,4 +7,4 @@ cd $RUNNER_TEMP
wget -q https://repo.hex.pm/builds/elixir/${1}${2}.zip
unzip -d .setup-elixir/elixir ${1}${2}.zip
rm ${1}${2}.zip
echo "::add-path::$(pwd)/.setup-elixir/elixir/bin"
echo "$(pwd)/.setup-elixir/elixir/bin" >> $GITHUB_PATH

View File

@@ -4,9 +4,9 @@ set -eo pipefail
cd $RUNNER_TEMP
wget -q -O otp.tar.gz https://repo.hex.pm/builds/otp/ubuntu-14.04/OTP-${1}.tar.gz
wget -q -O otp.tar.gz https://repo.hex.pm/builds/otp/${2}/OTP-${1}.tar.gz
mkdir -p .setup-elixir/otp
tar zxf otp.tar.gz -C .setup-elixir/otp --strip-components=1
rm otp.tar.gz
.setup-elixir/otp/Install -minimal $(pwd)/.setup-elixir/otp
echo "::add-path::$(pwd)/.setup-elixir/otp/bin"
echo "$(pwd)/.setup-elixir/otp/bin" >> $GITHUB_PATH

View File

@@ -22,9 +22,9 @@ async function installElixir(version, otpMajor) {
*
* @param {string} version
*/
async function installOTP(version) {
async function installOTP(version, osVersion) {
if (process.platform === 'linux') {
await exec(path.join(__dirname, 'install-otp'), [version])
await exec(path.join(__dirname, 'install-otp'), [version, osVersion])
return
}

View File

@@ -26,11 +26,16 @@ async function main() {
let installHex = core.getInput('install-hex')
installHex = installHex == null ? 'true' : installHex
let installRebar = core.getInput('install-rebar')
installRebar = installRebar == null ? 'true' : installRebar
console.log(`##[group]Installing OTP ${otpVersion}`)
await installOTP(otpVersion)
const experimentalOTP = core.getInput('experimental-otp')
const osVersion =
experimentalOTP === 'true' ? getRunnerOSVersion() : 'ubuntu-14.04'
console.log(`##[group]Installing OTP ${otpVersion} - built on ${osVersion}`)
await installOTP(otpVersion, osVersion)
console.log(`##[endgroup]`)
console.log(`##[group]Installing Elixir ${elixirVersion}`)
@@ -46,6 +51,7 @@ async function main() {
console.log(`##[add-matcher]${path.join(matchersPath, 'elixir.json')}`)
core.setOutput('otp-version', otpVersion)
core.setOutput('elixir-version', elixirVersion)
core.setOutput('osVersion', osVersion)
}
function checkPlatform() {
@@ -59,6 +65,16 @@ async function getOtpVersion(spec) {
return getVersionFromSpec(spec, await getOtpVersions()) || spec
}
function getRunnerOSVersion(experimentalOTP) {
const mapToUbuntuVersion = {
ubuntu16: 'ubuntu-16.04',
ubuntu18: 'ubuntu-18.04',
ubuntu20: 'ubuntu-20.04',
}
return mapToUbuntuVersion[process.env.ImageOS] || 'ubuntu-18.04'
}
exports.getElixirVersion = getElixirVersion
async function getElixirVersion(spec, otpVersion) {