You've already forked setup-dotnet
mirror of
https://github.com/actions/setup-dotnet.git
synced 2025-07-14 19:10:33 +07:00
Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
8aad93f856 |
60
.github/workflows/workflow.yml
vendored
60
.github/workflows/workflow.yml
vendored
@ -75,65 +75,7 @@ jobs:
|
|||||||
run: __tests__/verify-dotnet.sh 3.1.201 2.2.402
|
run: __tests__/verify-dotnet.sh 3.1.201 2.2.402
|
||||||
- name: Verify dotnet (Windows)
|
- name: Verify dotnet (Windows)
|
||||||
if: runner.os == 'windows'
|
if: runner.os == 'windows'
|
||||||
run: __tests__/verify-dotnet.ps1 3.1.201 2.2.402
|
run: __tests__/verify-dotnet.ps1 3.1.201
|
||||||
|
|
||||||
# Set new cache before 2 digit install
|
|
||||||
- name: Set new tool cache (macOS)
|
|
||||||
if: runner.os == 'macos'
|
|
||||||
run: |
|
|
||||||
echo "DOTNET_INSTALL_DIR=/Users/runner/.dotnet2" >> $GITHUB_ENV
|
|
||||||
- name: Set new tool cache (Ubuntu)
|
|
||||||
if: runner.os == 'linux'
|
|
||||||
run: |
|
|
||||||
echo "DOTNET_INSTALL_DIR=/home/runner/.dotnet2" >> $GITHUB_ENV
|
|
||||||
- name: Set new tool cache (Windows)
|
|
||||||
if: runner.os == 'windows'
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
echo "DOTNET_INSTALL_DIR=$LocalAppData\Microsoft\dotnet2" >> $GITHUB_ENV
|
|
||||||
# 2.0, 3.0, 5.0 needs to be in single quotes to interpret as a string instead of as an integer
|
|
||||||
- name: Setup dotnet '2.0'
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
dotnet-version: '2.0'
|
|
||||||
|
|
||||||
# Clear cache before .x version install
|
|
||||||
- name: Set new tool cache (macOS)
|
|
||||||
if: runner.os == 'macos'
|
|
||||||
run: |
|
|
||||||
echo "DOTNET_INSTALL_DIR=/Users/runner/.dotnet3" >> $GITHUB_ENV
|
|
||||||
- name: Set new tool cache (Ubuntu)
|
|
||||||
if: runner.os == 'linux'
|
|
||||||
run: |
|
|
||||||
echo "DOTNET_INSTALL_DIR=/home/runner/.dotnet3" >> $GITHUB_ENV
|
|
||||||
- name: Set new tool cache (Windows)
|
|
||||||
if: runner.os == 'windows'
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
echo "DOTNET_INSTALL_DIR=$LocalAppData\Microsoft\dotnet3" >> $GITHUB_ENV
|
|
||||||
- name: Setup dotnet 2.0.x
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
dotnet-version: 2.0.x
|
|
||||||
|
|
||||||
# Clear cache before .* version install
|
|
||||||
- name: Set new tool cache (macOS)
|
|
||||||
if: runner.os == 'macos'
|
|
||||||
run: |
|
|
||||||
echo "DOTNET_INSTALL_DIR=/Users/runner/.dotnet4" >> $GITHUB_ENV
|
|
||||||
- name: Set new tool cache (Ubuntu)
|
|
||||||
if: runner.os == 'linux'
|
|
||||||
run: |
|
|
||||||
echo "DOTNET_INSTALL_DIR=/home/runner/.dotnet4" >> $GITHUB_ENV
|
|
||||||
- name: Set new tool cache (Windows)
|
|
||||||
if: runner.os == 'windows'
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
echo "DOTNET_INSTALL_DIR=$LocalAppData\Microsoft\dotnet4" >> $GITHUB_ENV
|
|
||||||
- name: Setup dotnet 2.0.*
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
dotnet-version: 2.0.*
|
|
||||||
|
|
||||||
test-proxy:
|
test-proxy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
2
.licenses/npm/@actions/core.dep.yml
generated
2
.licenses/npm/@actions/core.dep.yml
generated
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: "@actions/core"
|
name: "@actions/core"
|
||||||
version: 1.2.6
|
version: 1.2.5
|
||||||
type: npm
|
type: npm
|
||||||
summary: Actions core lib
|
summary: Actions core lib
|
||||||
homepage: https://github.com/actions/toolkit/tree/main/packages/core
|
homepage: https://github.com/actions/toolkit/tree/main/packages/core
|
||||||
|
@ -4,21 +4,79 @@ import os = require('os');
|
|||||||
import path = require('path');
|
import path = require('path');
|
||||||
import hc = require('@actions/http-client');
|
import hc = require('@actions/http-client');
|
||||||
|
|
||||||
|
import each from 'jest-each';
|
||||||
|
|
||||||
const toolDir = path.join(__dirname, 'runner', 'tools');
|
const toolDir = path.join(__dirname, 'runner', 'tools');
|
||||||
const tempDir = path.join(__dirname, 'runner', 'temp');
|
const tempDir = path.join(__dirname, 'runner', 'temp');
|
||||||
|
|
||||||
process.env['RUNNER_TOOL_CACHE'] = toolDir;
|
process.env['RUNNER_TOOL_CACHE'] = toolDir;
|
||||||
process.env['RUNNER_TEMP'] = tempDir;
|
process.env['RUNNER_TEMP'] = tempDir;
|
||||||
|
import * as setup from '../src/setup-dotnet';
|
||||||
import * as installer from '../src/installer';
|
import * as installer from '../src/installer';
|
||||||
|
|
||||||
const IS_WINDOWS = process.platform === 'win32';
|
const IS_WINDOWS = process.platform === 'win32';
|
||||||
|
|
||||||
|
describe('version tests', () => {
|
||||||
|
each(['3.1.999', '3.1.101-preview.3']).test(
|
||||||
|
"Exact version '%s' should be the same",
|
||||||
|
vers => {
|
||||||
|
let versInfo = new installer.DotNetVersionInfo(vers);
|
||||||
|
|
||||||
|
expect(versInfo.isExactVersion()).toBe(true);
|
||||||
|
expect(versInfo.version()).toBe(vers);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
each([
|
||||||
|
['3.1.x', '3.1'],
|
||||||
|
['1.1.*', '1.1'],
|
||||||
|
['2.0', '2.0']
|
||||||
|
]).test("Generic version '%s' should be '%s'", (vers, resVers) => {
|
||||||
|
let versInfo = new installer.DotNetVersionInfo(vers);
|
||||||
|
|
||||||
|
expect(versInfo.isExactVersion()).toBe(false);
|
||||||
|
expect(versInfo.version()).toBe(resVers);
|
||||||
|
});
|
||||||
|
|
||||||
|
each([
|
||||||
|
'',
|
||||||
|
'.',
|
||||||
|
'..',
|
||||||
|
' . ',
|
||||||
|
'. ',
|
||||||
|
' .',
|
||||||
|
' . . ',
|
||||||
|
' .. ',
|
||||||
|
' . ',
|
||||||
|
'-1.-1',
|
||||||
|
'-1',
|
||||||
|
'-1.-1.-1',
|
||||||
|
'..3',
|
||||||
|
'1..3',
|
||||||
|
'1..',
|
||||||
|
'.2.3',
|
||||||
|
'.2.x',
|
||||||
|
'1',
|
||||||
|
'2.x',
|
||||||
|
'*.*.1',
|
||||||
|
'*.1',
|
||||||
|
'*.',
|
||||||
|
'1.2.',
|
||||||
|
'1.2.-abc',
|
||||||
|
'a.b',
|
||||||
|
'a.b.c',
|
||||||
|
'a.b.c-preview',
|
||||||
|
' 0 . 1 . 2 '
|
||||||
|
]).test("Malformed version '%s' should throw", vers => {
|
||||||
|
expect(() => new installer.DotNetVersionInfo(vers)).toThrow();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('installer tests', () => {
|
describe('installer tests', () => {
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
process.env.RUNNER_TOOL_CACHE = toolDir;
|
process.env.RUNNER_TOOL_CACHE = toolDir;
|
||||||
process.env.DOTNET_INSTALL_DIR = toolDir;
|
process.env.DOTNET_INSTALL_DIR = toolDir;
|
||||||
process.env.RUNNER_TEMP = tempDir;
|
process.env.RUNNER_TEMP = tempDir;
|
||||||
process.env.DOTNET_ROOT = '';
|
|
||||||
await io.rmRF(toolDir);
|
await io.rmRF(toolDir);
|
||||||
await io.rmRF(tempDir);
|
await io.rmRF(tempDir);
|
||||||
});
|
});
|
||||||
@ -32,6 +90,47 @@ describe('installer tests', () => {
|
|||||||
}
|
}
|
||||||
}, 30000);
|
}, 30000);
|
||||||
|
|
||||||
|
it('Resolving a normal generic version works', async () => {
|
||||||
|
const dotnetInstaller = new installer.DotnetCoreInstaller('3.1.x');
|
||||||
|
let versInfo = await dotnetInstaller.resolveVersion(
|
||||||
|
new installer.DotNetVersionInfo('3.1.x')
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(versInfo.startsWith('3.1.'));
|
||||||
|
}, 100000);
|
||||||
|
|
||||||
|
it('Resolving a nonexistent generic version fails', async () => {
|
||||||
|
const dotnetInstaller = new installer.DotnetCoreInstaller('999.1.x');
|
||||||
|
try {
|
||||||
|
await dotnetInstaller.resolveVersion(
|
||||||
|
new installer.DotNetVersionInfo('999.1.x')
|
||||||
|
);
|
||||||
|
fail();
|
||||||
|
} catch {
|
||||||
|
expect(true);
|
||||||
|
}
|
||||||
|
}, 100000);
|
||||||
|
|
||||||
|
it('Resolving a exact stable version works', async () => {
|
||||||
|
const dotnetInstaller = new installer.DotnetCoreInstaller('3.1.201');
|
||||||
|
let versInfo = await dotnetInstaller.resolveVersion(
|
||||||
|
new installer.DotNetVersionInfo('3.1.201')
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(versInfo).toBe('3.1.201');
|
||||||
|
}, 100000);
|
||||||
|
|
||||||
|
it('Resolving a exact preview version works', async () => {
|
||||||
|
const dotnetInstaller = new installer.DotnetCoreInstaller(
|
||||||
|
'5.0.0-preview.6'
|
||||||
|
);
|
||||||
|
let versInfo = await dotnetInstaller.resolveVersion(
|
||||||
|
new installer.DotNetVersionInfo('5.0.0-preview.6')
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(versInfo).toBe('5.0.0-preview.6');
|
||||||
|
}, 100000);
|
||||||
|
|
||||||
it('Acquires version of dotnet if no matching version is installed', async () => {
|
it('Acquires version of dotnet if no matching version is installed', async () => {
|
||||||
await getDotnet('3.1.201');
|
await getDotnet('3.1.201');
|
||||||
expect(fs.existsSync(path.join(toolDir, 'sdk', '3.1.201'))).toBe(true);
|
expect(fs.existsSync(path.join(toolDir, 'sdk', '3.1.201'))).toBe(true);
|
||||||
@ -40,30 +139,24 @@ describe('installer tests', () => {
|
|||||||
} else {
|
} else {
|
||||||
expect(fs.existsSync(path.join(toolDir, 'dotnet'))).toBe(true);
|
expect(fs.existsSync(path.join(toolDir, 'dotnet'))).toBe(true);
|
||||||
}
|
}
|
||||||
|
}, 400000); //This needs some time to download on "slower" internet connections
|
||||||
|
|
||||||
expect(process.env.DOTNET_ROOT).toBeDefined;
|
it('Acquires version of dotnet from global.json if no matching version is installed', async () => {
|
||||||
expect(process.env.PATH).toBeDefined;
|
const globalJsonPath = path.join(process.cwd(), 'global.json');
|
||||||
expect(process.env.DOTNET_ROOT).toBe(toolDir);
|
const jsonContents = `{${os.EOL}"sdk": {${os.EOL}"version": "3.1.201"${os.EOL}}${os.EOL}}`;
|
||||||
expect(process.env.PATH?.startsWith(toolDir)).toBe(true);
|
if (!fs.existsSync(globalJsonPath)) {
|
||||||
}, 600000); //This needs some time to download on "slower" internet connections
|
fs.writeFileSync(globalJsonPath, jsonContents);
|
||||||
|
}
|
||||||
|
await setup.run();
|
||||||
|
|
||||||
it('Acquires generic version of dotnet if no matching version is installed', async () => {
|
expect(fs.existsSync(path.join(toolDir, 'sdk', '3.1.201'))).toBe(true);
|
||||||
await getDotnet('3.1');
|
|
||||||
var directory = fs
|
|
||||||
.readdirSync(path.join(toolDir, 'sdk'))
|
|
||||||
.filter(fn => fn.startsWith('3.1.'));
|
|
||||||
expect(directory.length > 0).toBe(true);
|
|
||||||
if (IS_WINDOWS) {
|
if (IS_WINDOWS) {
|
||||||
expect(fs.existsSync(path.join(toolDir, 'dotnet.exe'))).toBe(true);
|
expect(fs.existsSync(path.join(toolDir, 'dotnet.exe'))).toBe(true);
|
||||||
} else {
|
} else {
|
||||||
expect(fs.existsSync(path.join(toolDir, 'dotnet'))).toBe(true);
|
expect(fs.existsSync(path.join(toolDir, 'dotnet'))).toBe(true);
|
||||||
}
|
}
|
||||||
|
fs.unlinkSync(globalJsonPath);
|
||||||
expect(process.env.DOTNET_ROOT).toBeDefined;
|
}, 100000);
|
||||||
expect(process.env.PATH).toBeDefined;
|
|
||||||
expect(process.env.DOTNET_ROOT).toBe(toolDir);
|
|
||||||
expect(process.env.PATH?.startsWith(toolDir)).toBe(true);
|
|
||||||
}, 600000); //This needs some time to download on "slower" internet connections
|
|
||||||
|
|
||||||
it('Throws if no location contains correct dotnet version', async () => {
|
it('Throws if no location contains correct dotnet version', async () => {
|
||||||
let thrown = false;
|
let thrown = false;
|
||||||
|
@ -29,7 +29,7 @@ describe('setup-dotnet tests', () => {
|
|||||||
}
|
}
|
||||||
}, 30000);
|
}, 30000);
|
||||||
|
|
||||||
it('Acquires version of dotnet from global.json if no matching version is installed', async () => {
|
it('Acquires version of dotnet if no matching version is installed', async () => {
|
||||||
const globalJsonPath = path.join(process.cwd(), 'global.json');
|
const globalJsonPath = path.join(process.cwd(), 'global.json');
|
||||||
const jsonContents = `{${os.EOL}"sdk": {${os.EOL}"version": "3.1.201"${os.EOL}}${os.EOL}}`;
|
const jsonContents = `{${os.EOL}"sdk": {${os.EOL}"version": "3.1.201"${os.EOL}}${os.EOL}}`;
|
||||||
if (!fs.existsSync(globalJsonPath)) {
|
if (!fs.existsSync(globalJsonPath)) {
|
||||||
@ -43,5 +43,6 @@ describe('setup-dotnet tests', () => {
|
|||||||
} else {
|
} else {
|
||||||
expect(fs.existsSync(path.join(toolDir, 'dotnet'))).toBe(true);
|
expect(fs.existsSync(path.join(toolDir, 'dotnet'))).toBe(true);
|
||||||
}
|
}
|
||||||
}, 400000);
|
fs.unlinkSync(globalJsonPath);
|
||||||
|
}, 100000);
|
||||||
});
|
});
|
||||||
|
@ -1,90 +0,0 @@
|
|||||||
import each from 'jest-each';
|
|
||||||
import * as installer from '../src/installer';
|
|
||||||
|
|
||||||
describe('version tests', () => {
|
|
||||||
each(['3.1.999', '3.1.101-preview.3']).test(
|
|
||||||
"Exact version '%s' should be the same",
|
|
||||||
vers => {
|
|
||||||
let versInfo = new installer.DotNetVersionInfo(vers);
|
|
||||||
|
|
||||||
expect(versInfo.isExactVersion()).toBe(true);
|
|
||||||
expect(versInfo.version()).toBe(vers);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
each([
|
|
||||||
['3.1.x', '3.1'],
|
|
||||||
['1.1.*', '1.1'],
|
|
||||||
['2.0', '2.0']
|
|
||||||
]).test("Generic version '%s' should be '%s'", (vers, resVers) => {
|
|
||||||
let versInfo = new installer.DotNetVersionInfo(vers);
|
|
||||||
|
|
||||||
expect(versInfo.isExactVersion()).toBe(false);
|
|
||||||
expect(versInfo.version()).toBe(resVers);
|
|
||||||
});
|
|
||||||
|
|
||||||
each([
|
|
||||||
'',
|
|
||||||
'.',
|
|
||||||
'..',
|
|
||||||
' . ',
|
|
||||||
'. ',
|
|
||||||
' .',
|
|
||||||
' . . ',
|
|
||||||
' .. ',
|
|
||||||
' . ',
|
|
||||||
'-1.-1',
|
|
||||||
'-1',
|
|
||||||
'-1.-1.-1',
|
|
||||||
'..3',
|
|
||||||
'1..3',
|
|
||||||
'1..',
|
|
||||||
'.2.3',
|
|
||||||
'.2.x',
|
|
||||||
'1',
|
|
||||||
'2.x',
|
|
||||||
'*.*.1',
|
|
||||||
'*.1',
|
|
||||||
'*.',
|
|
||||||
'1.2.',
|
|
||||||
'1.2.-abc',
|
|
||||||
'a.b',
|
|
||||||
'a.b.c',
|
|
||||||
'a.b.c-preview',
|
|
||||||
' 0 . 1 . 2 '
|
|
||||||
]).test("Malformed version '%s' should throw", vers => {
|
|
||||||
expect(() => new installer.DotNetVersionInfo(vers)).toThrow();
|
|
||||||
});
|
|
||||||
|
|
||||||
each([
|
|
||||||
['3.1.x', '3.1.'],
|
|
||||||
['3.1.*', '3.1.'],
|
|
||||||
['3.1', '3.1.'],
|
|
||||||
['5.0.0-preview.6', '5.0.0-preview.6'],
|
|
||||||
['3.1.201', '3.1.201']
|
|
||||||
]).test(
|
|
||||||
"Resolving version '%s' as '%s'",
|
|
||||||
async (input, expectedVersion) => {
|
|
||||||
const dotnetInstaller = new installer.DotnetCoreInstaller(input);
|
|
||||||
let versInfo = await dotnetInstaller.resolveVersion(
|
|
||||||
new installer.DotNetVersionInfo(input)
|
|
||||||
);
|
|
||||||
console.log(versInfo);
|
|
||||||
|
|
||||||
expect(versInfo.startsWith(expectedVersion));
|
|
||||||
},
|
|
||||||
100000
|
|
||||||
);
|
|
||||||
|
|
||||||
it('Resolving a nonexistent generic version fails', async () => {
|
|
||||||
const dotnetInstaller = new installer.DotnetCoreInstaller('999.1.x');
|
|
||||||
try {
|
|
||||||
await dotnetInstaller.resolveVersion(
|
|
||||||
new installer.DotNetVersionInfo('999.1.x')
|
|
||||||
);
|
|
||||||
fail();
|
|
||||||
} catch {
|
|
||||||
expect(true);
|
|
||||||
}
|
|
||||||
}, 100000);
|
|
||||||
});
|
|
@ -6,7 +6,7 @@ branding:
|
|||||||
color: green
|
color: green
|
||||||
inputs:
|
inputs:
|
||||||
dotnet-version:
|
dotnet-version:
|
||||||
description: 'SDK version to use. Examples: 2.2.104, 3.1, 3.1.x'
|
description: 'Optional SDK version to use. If not provided, will install global.json version when available. Examples: 2.2.104, 3.1, 3.1.x'
|
||||||
source-url:
|
source-url:
|
||||||
description: 'Optional package source for which to set up authentication. Will consult any existing NuGet.config in the root of the repo and provide a temporary NuGet.config using the NUGET_AUTH_TOKEN environment variable as a ClearTextPassword'
|
description: 'Optional package source for which to set up authentication. Will consult any existing NuGet.config in the root of the repo and provide a temporary NuGet.config using the NUGET_AUTH_TOKEN environment variable as a ClearTextPassword'
|
||||||
owner:
|
owner:
|
||||||
|
112
dist/index.js
vendored
112
dist/index.js
vendored
@ -2932,32 +2932,6 @@ module.exports = function(tagname, parent, val) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 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:
|
/***/ 87:
|
||||||
@ -2967,42 +2941,6 @@ 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
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 118:
|
/***/ 118:
|
||||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
@ -8998,7 +8936,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const os = __importStar(__webpack_require__(87));
|
const os = __importStar(__webpack_require__(87));
|
||||||
const utils_1 = __webpack_require__(82);
|
|
||||||
/**
|
/**
|
||||||
* Commands
|
* Commands
|
||||||
*
|
*
|
||||||
@ -9052,14 +8989,28 @@ class Command {
|
|||||||
return cmdStr;
|
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) {
|
function escapeData(s) {
|
||||||
return utils_1.toCommandValue(s)
|
return toCommandValue(s)
|
||||||
.replace(/%/g, '%25')
|
.replace(/%/g, '%25')
|
||||||
.replace(/\r/g, '%0D')
|
.replace(/\r/g, '%0D')
|
||||||
.replace(/\n/g, '%0A');
|
.replace(/\n/g, '%0A');
|
||||||
}
|
}
|
||||||
function escapeProperty(s) {
|
function escapeProperty(s) {
|
||||||
return utils_1.toCommandValue(s)
|
return toCommandValue(s)
|
||||||
.replace(/%/g, '%25')
|
.replace(/%/g, '%25')
|
||||||
.replace(/\r/g, '%0D')
|
.replace(/\r/g, '%0D')
|
||||||
.replace(/\n/g, '%0A')
|
.replace(/\n/g, '%0A')
|
||||||
@ -11290,8 +11241,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const command_1 = __webpack_require__(431);
|
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 os = __importStar(__webpack_require__(87));
|
||||||
const path = __importStar(__webpack_require__(622));
|
const path = __importStar(__webpack_require__(622));
|
||||||
/**
|
/**
|
||||||
@ -11318,17 +11267,9 @@ var ExitCode;
|
|||||||
*/
|
*/
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
function exportVariable(name, val) {
|
function exportVariable(name, val) {
|
||||||
const convertedVal = utils_1.toCommandValue(val);
|
const convertedVal = command_1.toCommandValue(val);
|
||||||
process.env[name] = convertedVal;
|
process.env[name] = convertedVal;
|
||||||
const filePath = process.env['GITHUB_ENV'] || '';
|
command_1.issueCommand('set-env', { name }, convertedVal);
|
||||||
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;
|
exports.exportVariable = exportVariable;
|
||||||
/**
|
/**
|
||||||
@ -11344,13 +11285,7 @@ exports.setSecret = setSecret;
|
|||||||
* @param inputPath
|
* @param inputPath
|
||||||
*/
|
*/
|
||||||
function addPath(inputPath) {
|
function addPath(inputPath) {
|
||||||
const filePath = process.env['GITHUB_PATH'] || '';
|
command_1.issueCommand('add-path', {}, inputPath);
|
||||||
if (filePath) {
|
|
||||||
file_command_1.issueCommand('PATH', inputPath);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
command_1.issueCommand('add-path', {}, inputPath);
|
|
||||||
}
|
|
||||||
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
|
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
|
||||||
}
|
}
|
||||||
exports.addPath = addPath;
|
exports.addPath = addPath;
|
||||||
@ -16966,8 +16901,8 @@ class DotnetCoreInstaller {
|
|||||||
fs_1.chmodSync(escapedScript, '777');
|
fs_1.chmodSync(escapedScript, '777');
|
||||||
const scriptPath = yield io.which(escapedScript, true);
|
const scriptPath = yield io.which(escapedScript, true);
|
||||||
let scriptArguments = [];
|
let scriptArguments = [];
|
||||||
if (calculatedVersion) {
|
if (this.version) {
|
||||||
scriptArguments.push('--version', calculatedVersion);
|
scriptArguments.push('--version', this.version);
|
||||||
}
|
}
|
||||||
// process.env must be explicitly passed in for DOTNET_INSTALL_DIR to be used
|
// process.env must be explicitly passed in for DOTNET_INSTALL_DIR to be used
|
||||||
resultCode = yield exec.exec(`"${scriptPath}"`, scriptArguments, {
|
resultCode = yield exec.exec(`"${scriptPath}"`, scriptArguments, {
|
||||||
@ -16981,7 +16916,6 @@ class DotnetCoreInstaller {
|
|||||||
}
|
}
|
||||||
if (process.env['DOTNET_INSTALL_DIR']) {
|
if (process.env['DOTNET_INSTALL_DIR']) {
|
||||||
core.addPath(process.env['DOTNET_INSTALL_DIR']);
|
core.addPath(process.env['DOTNET_INSTALL_DIR']);
|
||||||
core.exportVariable('DOTNET_ROOT', process.env['DOTNET_INSTALL_DIR']);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (IS_WINDOWS) {
|
if (IS_WINDOWS) {
|
||||||
@ -16992,7 +16926,6 @@ class DotnetCoreInstaller {
|
|||||||
else {
|
else {
|
||||||
// This is the default set in install-dotnet.sh
|
// This is the default set in install-dotnet.sh
|
||||||
core.addPath(path.join(process.env['HOME'] + '', '.dotnet'));
|
core.addPath(path.join(process.env['HOME'] + '', '.dotnet'));
|
||||||
core.exportVariable('DOTNET_ROOT', path.join(process.env['HOME'] + '', '.dotnet'));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(process.env['PATH']);
|
console.log(process.env['PATH']);
|
||||||
@ -17039,8 +16972,7 @@ class DotnetCoreInstaller {
|
|||||||
releasesInfo = releasesInfo.filter((info) => {
|
releasesInfo = releasesInfo.filter((info) => {
|
||||||
// channel-version is the first 2 elements of the version (e.g. 2.1), filter out versions that don't match 2.1.x.
|
// channel-version is the first 2 elements of the version (e.g. 2.1), filter out versions that don't match 2.1.x.
|
||||||
const sdkParts = info['channel-version'].split('.');
|
const sdkParts = info['channel-version'].split('.');
|
||||||
if (versionParts.length >= 2 &&
|
if (versionParts.length >= 2 && versionParts[1] != 'x') {
|
||||||
!(versionParts[1] == 'x' || versionParts[1] == '*')) {
|
|
||||||
return versionParts[0] == sdkParts[0] && versionParts[1] == sdkParts[1];
|
return versionParts[0] == sdkParts[0] && versionParts[1] == sdkParts[1];
|
||||||
}
|
}
|
||||||
return versionParts[0] == sdkParts[0];
|
return versionParts[0] == sdkParts[0];
|
||||||
|
52
package-lock.json
generated
52
package-lock.json
generated
@ -5,9 +5,9 @@
|
|||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": {
|
"@actions/core": {
|
||||||
"version": "1.2.6",
|
"version": "1.2.5",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.6.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.5.tgz",
|
||||||
"integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA=="
|
"integrity": "sha512-mwpoNjHSWWh0IiALdDEQi3tru124JKn0yVNziIBzTME8QRv7thwoghVuT1jBRjFvdtoHsqD58IRHy1nf86paRg=="
|
||||||
},
|
},
|
||||||
"@actions/exec": {
|
"@actions/exec": {
|
||||||
"version": "1.0.4",
|
"version": "1.0.4",
|
||||||
@ -610,8 +610,7 @@
|
|||||||
"slash": "^3.0.0",
|
"slash": "^3.0.0",
|
||||||
"source-map": "^0.6.0",
|
"source-map": "^0.6.0",
|
||||||
"string-length": "^4.0.1",
|
"string-length": "^4.0.1",
|
||||||
"terminal-link": "^2.0.0",
|
"terminal-link": "^2.0.0"
|
||||||
"v8-to-istanbul": "^5.0.1"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"slash": {
|
"slash": {
|
||||||
@ -619,6 +618,23 @@
|
|||||||
"resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
|
||||||
"integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==",
|
"integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==",
|
||||||
"dev": true
|
"dev": true
|
||||||
|
},
|
||||||
|
"v8-to-istanbul": {
|
||||||
|
"version": "4.1.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-4.1.4.tgz",
|
||||||
|
"integrity": "sha512-Rw6vJHj1mbdK8edjR7+zuJrpDtKIgNdAvTSAcpYfgMIw+u2dPDntD3dgN4XQFLU2/fvFQdzj+EeSGfd/jnY5fQ==",
|
||||||
|
"requires": {
|
||||||
|
"@types/istanbul-lib-coverage": "^2.0.1",
|
||||||
|
"convert-source-map": "^1.6.0",
|
||||||
|
"source-map": "^0.7.3"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"source-map": {
|
||||||
|
"version": "0.7.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz",
|
||||||
|
"integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ=="
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -906,8 +922,7 @@
|
|||||||
"@types/istanbul-lib-coverage": {
|
"@types/istanbul-lib-coverage": {
|
||||||
"version": "2.0.2",
|
"version": "2.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.2.tgz",
|
||||||
"integrity": "sha512-rsZg7eL+Xcxsxk2XlBt9KcG8nOp9iYdKCOikY9x2RFJCyOdNj4MKPQty0e8oZr29vVAzKXr1BmR+kZauti3o1w==",
|
"integrity": "sha512-rsZg7eL+Xcxsxk2XlBt9KcG8nOp9iYdKCOikY9x2RFJCyOdNj4MKPQty0e8oZr29vVAzKXr1BmR+kZauti3o1w=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"@types/istanbul-lib-report": {
|
"@types/istanbul-lib-report": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
@ -1596,7 +1611,6 @@
|
|||||||
"version": "1.7.0",
|
"version": "1.7.0",
|
||||||
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz",
|
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz",
|
||||||
"integrity": "sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==",
|
"integrity": "sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==",
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"safe-buffer": "~5.1.1"
|
"safe-buffer": "~5.1.1"
|
||||||
}
|
}
|
||||||
@ -4214,8 +4228,7 @@
|
|||||||
"safe-buffer": {
|
"safe-buffer": {
|
||||||
"version": "5.1.2",
|
"version": "5.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
|
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"safe-regex": {
|
"safe-regex": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
@ -5147,25 +5160,6 @@
|
|||||||
"integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==",
|
"integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"v8-to-istanbul": {
|
|
||||||
"version": "5.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-5.0.1.tgz",
|
|
||||||
"integrity": "sha512-mbDNjuDajqYe3TXFk5qxcQy8L1msXNE37WTlLoqqpBfRsimbNcrlhQlDPntmECEcUvdC+AQ8CyMMf6EUx1r74Q==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"@types/istanbul-lib-coverage": "^2.0.1",
|
|
||||||
"convert-source-map": "^1.6.0",
|
|
||||||
"source-map": "^0.7.3"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"source-map": {
|
|
||||||
"version": "0.7.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz",
|
|
||||||
"integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==",
|
|
||||||
"dev": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"validate-npm-package-license": {
|
"validate-npm-package-license": {
|
||||||
"version": "3.0.4",
|
"version": "3.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz",
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
"author": "GitHub",
|
"author": "GitHub",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.2.6",
|
"@actions/core": "^1.2.5",
|
||||||
"@actions/exec": "^1.0.4",
|
"@actions/exec": "^1.0.4",
|
||||||
"@actions/github": "^1.1.0",
|
"@actions/github": "^1.1.0",
|
||||||
"@actions/http-client": "^1.0.8",
|
"@actions/http-client": "^1.0.8",
|
||||||
|
@ -146,8 +146,8 @@ export class DotnetCoreInstaller {
|
|||||||
const scriptPath = await io.which(escapedScript, true);
|
const scriptPath = await io.which(escapedScript, true);
|
||||||
|
|
||||||
let scriptArguments: string[] = [];
|
let scriptArguments: string[] = [];
|
||||||
if (calculatedVersion) {
|
if (this.version) {
|
||||||
scriptArguments.push('--version', calculatedVersion);
|
scriptArguments.push('--version', this.version);
|
||||||
}
|
}
|
||||||
|
|
||||||
// process.env must be explicitly passed in for DOTNET_INSTALL_DIR to be used
|
// process.env must be explicitly passed in for DOTNET_INSTALL_DIR to be used
|
||||||
@ -163,7 +163,6 @@ export class DotnetCoreInstaller {
|
|||||||
|
|
||||||
if (process.env['DOTNET_INSTALL_DIR']) {
|
if (process.env['DOTNET_INSTALL_DIR']) {
|
||||||
core.addPath(process.env['DOTNET_INSTALL_DIR']);
|
core.addPath(process.env['DOTNET_INSTALL_DIR']);
|
||||||
core.exportVariable('DOTNET_ROOT', process.env['DOTNET_INSTALL_DIR']);
|
|
||||||
} else {
|
} else {
|
||||||
if (IS_WINDOWS) {
|
if (IS_WINDOWS) {
|
||||||
// This is the default set in install-dotnet.ps1
|
// This is the default set in install-dotnet.ps1
|
||||||
@ -177,10 +176,6 @@ export class DotnetCoreInstaller {
|
|||||||
} else {
|
} else {
|
||||||
// This is the default set in install-dotnet.sh
|
// This is the default set in install-dotnet.sh
|
||||||
core.addPath(path.join(process.env['HOME'] + '', '.dotnet'));
|
core.addPath(path.join(process.env['HOME'] + '', '.dotnet'));
|
||||||
core.exportVariable(
|
|
||||||
'DOTNET_ROOT',
|
|
||||||
path.join(process.env['HOME'] + '', '.dotnet')
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,25 +245,19 @@ export class DotnetCoreInstaller {
|
|||||||
const response = await httpClient.getJson<any>(DotNetCoreIndexUrl);
|
const response = await httpClient.getJson<any>(DotNetCoreIndexUrl);
|
||||||
const result = response.result || {};
|
const result = response.result || {};
|
||||||
let releasesInfo: any[] = result['releases-index'];
|
let releasesInfo: any[] = result['releases-index'];
|
||||||
|
|
||||||
releasesInfo = releasesInfo.filter((info: any) => {
|
releasesInfo = releasesInfo.filter((info: any) => {
|
||||||
// channel-version is the first 2 elements of the version (e.g. 2.1), filter out versions that don't match 2.1.x.
|
// channel-version is the first 2 elements of the version (e.g. 2.1), filter out versions that don't match 2.1.x.
|
||||||
const sdkParts: string[] = info['channel-version'].split('.');
|
const sdkParts: string[] = info['channel-version'].split('.');
|
||||||
if (
|
if (versionParts.length >= 2 && versionParts[1] != 'x') {
|
||||||
versionParts.length >= 2 &&
|
|
||||||
!(versionParts[1] == 'x' || versionParts[1] == '*')
|
|
||||||
) {
|
|
||||||
return versionParts[0] == sdkParts[0] && versionParts[1] == sdkParts[1];
|
return versionParts[0] == sdkParts[0] && versionParts[1] == sdkParts[1];
|
||||||
}
|
}
|
||||||
return versionParts[0] == sdkParts[0];
|
return versionParts[0] == sdkParts[0];
|
||||||
});
|
});
|
||||||
|
|
||||||
if (releasesInfo.length === 0) {
|
if (releasesInfo.length === 0) {
|
||||||
throw `Could not find info for version ${versionParts.join(
|
throw `Could not find info for version ${versionParts.join(
|
||||||
'.'
|
'.'
|
||||||
)} at ${DotNetCoreIndexUrl}`;
|
)} at ${DotNetCoreIndexUrl}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return releasesInfo[0]['releases.json'];
|
return releasesInfo[0]['releases.json'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user