Skip to content

Commit

Permalink
Release 4.0.0-beta.3
Browse files Browse the repository at this point in the history
  • Loading branch information
rwjblue committed Oct 3, 2022
1 parent ed142f2 commit c3b1019
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 12 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@




## v4.0.0-beta.3 (2022-10-03)

#### :bug: Bug Fix
* [#110](https://github.com/volta-cli/action/pull/110) Fix for self-hoster runners (instead of relying on `RUNNER_TEMP`) ([@jeevcat](https://github.com/jeevcat))
* [#111](https://github.com/volta-cli/action/pull/111) Fall back to downloading latest version from volta.sh on rate-limit ([@ZauberNerd](https://github.com/ZauberNerd))

#### Committers: 2
- Björn Brauer ([@ZauberNerd](https://github.com/ZauberNerd))
- Sam Jeeves ([@jeevcat](https://github.com/jeevcat))


## v4.0.0-beta.2 (2022-09-09)

#### :rocket: Enhancement
Expand Down
44 changes: 35 additions & 9 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22839,14 +22839,14 @@ var core = __nccwpck_require__(2186);
var external_fs_ = __nccwpck_require__(7147);
// EXTERNAL MODULE: external "path"
var external_path_ = __nccwpck_require__(1017);
// EXTERNAL MODULE: ./node_modules/@actions/exec/lib/exec.js
var exec = __nccwpck_require__(1514);
// EXTERNAL MODULE: ./node_modules/@actions/http-client/lib/index.js
var lib = __nccwpck_require__(6255);
// EXTERNAL MODULE: ./node_modules/@actions/tool-cache/lib/tool-cache.js
var tool_cache = __nccwpck_require__(7784);
// EXTERNAL MODULE: ./node_modules/@actions/io/lib/io.js
var io = __nccwpck_require__(7436);
// EXTERNAL MODULE: ./node_modules/@actions/exec/lib/exec.js
var exec = __nccwpck_require__(1514);
// EXTERNAL MODULE: ./node_modules/@actions/tool-cache/lib/tool-cache.js
var tool_cache = __nccwpck_require__(7784);
// EXTERNAL MODULE: external "os"
var external_os_ = __nccwpck_require__(2037);
// EXTERNAL MODULE: ./node_modules/semver/index.js
Expand Down Expand Up @@ -22888,11 +22888,36 @@ async function getLatestVolta(authToken) {
authorization: authToken,
};
}
const response = await http.getJson(url, headers);
if (!response.result) {
try {
const response = await http.getJson(url, headers);
if (!response.result) {
throw new Error(`volta-cli/action: Could not download latest release from ${url}`);
}
return semver.clean(response.result.name);
}
catch (error) {
if (error instanceof lib.HttpClientError &&
(error.statusCode === 403 || error.statusCode === 429)) {
core.info(`Received HTTP status code ${error.statusCode}. This usually indicates the rate limit has been exceeded`);
return await getLatestVoltaFromVoltaSH();
}
else {
throw error;
}
}
}
async function getLatestVoltaFromVoltaSH() {
const url = 'https://volta.sh/latest-version';
core.info(`Falling back to download from ${url}`);
const http = new lib.HttpClient('volta-cli/action', [], {
allowRetries: true,
maxRetries: 3,
});
const response = await http.get(url);
if (response.message.statusCode !== 200) {
throw new Error(`volta-cli/action: Could not download latest release from ${url}`);
}
return semver.clean(response.result.name);
return semver.clean(await response.readBody());
}
function voltaVersionHasSetup(version) {
return semver.gte(version, '0.7.0');
Expand Down Expand Up @@ -23025,7 +23050,8 @@ async function acquireVolta(version, options) {
}
async function setupVolta(version, voltaHome) {
if (voltaVersionHasSetup(version)) {
await (0,exec.exec)(external_path_.join(voltaHome, 'bin', 'volta'), ['setup'], {
const executable = external_path_.join(voltaHome, 'bin', 'volta');
await (0,exec.exec)(executable, ['setup'], {
env: {
// VOLTA_HOME needs to be set before calling volta setup
VOLTA_HOME: voltaHome,
Expand Down Expand Up @@ -23095,10 +23121,10 @@ async function getVolta(options) {
if (voltaHome === '') {
// download, extract, cache
const toolRoot = await acquireVolta(version, options);
await setupVolta(version, toolRoot);
// Install into the local tool cache - node extracts with a root folder
// that matches the fileName downloaded
voltaHome = await tool_cache.cacheDir(toolRoot, 'volta', version);
await setupVolta(version, voltaHome);
core.info(`caching volta@${version} into ${voltaHome}`);
}
else {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@volta-cli/action",
"version": "4.0.0-beta.2",
"version": "4.0.0-beta.3",
"private": true,
"description": "Setup volta for usage in your CI runs",
"keywords": [
Expand Down

0 comments on commit c3b1019

Please sign in to comment.