Address latest review feedback
This commit is contained in:
parent
998be8d08f
commit
6924f73ee0
18
README.md
18
README.md
|
@ -72,22 +72,26 @@ jobs:
|
||||||
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
|
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
|
||||||
username: ${{ github.actor }} # username for server authentication
|
username: ${{ github.actor }} # username for server authentication
|
||||||
password: ${{ github.token }} # password or token for authentication
|
password: ${{ github.token }} # password or token for authentication
|
||||||
|
|
||||||
- name: Build with Maven
|
- name: Build with Maven
|
||||||
run: mvn -B package --file pom.xml
|
run: mvn -B package --file pom.xml
|
||||||
|
|
||||||
- name: Publish to GitHub Packages Apache Maven
|
- name: Publish to GitHub Packages Apache Maven
|
||||||
run: mvn deploy
|
run: mvn deploy
|
||||||
|
|
||||||
- name: Set up Apache Maven Central
|
- name: Set up Apache Maven Central
|
||||||
uses: actions/setup-java@v1
|
uses: actions/setup-java@v1
|
||||||
with: # running setup-java again overwrites the settings.xml
|
with: # running setup-java again overwrites the settings.xml
|
||||||
java-version: 1.8
|
java-version: 1.8
|
||||||
server-id: maven
|
server-id: maven
|
||||||
username: maven_username
|
server-username: maven_username
|
||||||
password: ${{ secrets.MAVEN_CENTRAL_TOKEN }} # password from secrets store
|
server-password: ${{ secrets.MAVEN_CENTRAL_TOKEN }} # password from secrets store
|
||||||
|
|
||||||
- name: Publish to Apache Maven Central
|
- name: Publish to Apache Maven Central
|
||||||
run: mvn deploy
|
run: mvn deploy
|
||||||
```
|
```
|
||||||
|
|
||||||
***NOTE: The `settings.xml` file is created in the Actions $HOME directory. If you have an existing `settings.xml` file at that location, it will be overwritten***
|
***NOTE: The `settings.xml` file is created in the Actions $HOME directory. If you have an existing `settings.xml` file at that location, it will be overwritten. See below for using the `settings-path` to change your `settings.xml` file location.***
|
||||||
|
|
||||||
See the help docs on [Publishing a Package](https://help.github.com/en/github/managing-packages-with-github-packages/configuring-apache-maven-for-use-with-github-packages#publishing-a-package) for more information on the `pom.xml` file.
|
See the help docs on [Publishing a Package](https://help.github.com/en/github/managing-packages-with-github-packages/configuring-apache-maven-for-use-with-github-packages#publishing-a-package) for more information on the `pom.xml` file.
|
||||||
|
|
||||||
|
@ -114,7 +118,7 @@ jobs:
|
||||||
PASSWORD: ${{ secrets.GITHUB_TOKEN }}
|
PASSWORD: ${{ secrets.GITHUB_TOKEN }}
|
||||||
```
|
```
|
||||||
|
|
||||||
***NOTE: The `USERNAME` and `PASSWORD` need to correspond to the credentials environment variables used in the publishing section of your `build.gradle`..***
|
***NOTE: The `USERNAME` and `PASSWORD` need to correspond to the credentials environment variables used in the publishing section of your `build.gradle`.***
|
||||||
|
|
||||||
See the help docs on [Publishing a Package with Gradle](https://help.github.com/en/github/managing-packages-with-github-packages/configuring-gradle-for-use-with-github-packages#example-using-gradle-groovy-for-a-single-package-in-a-repository) for more information on the `build.gradle` configuration file.
|
See the help docs on [Publishing a Package with Gradle](https://help.github.com/en/github/managing-packages-with-github-packages/configuring-gradle-for-use-with-github-packages#example-using-gradle-groovy-for-a-single-package-in-a-repository) for more information on the `build.gradle` configuration file.
|
||||||
|
|
||||||
|
@ -135,11 +139,13 @@ jobs:
|
||||||
with:
|
with:
|
||||||
java-version: 1.8
|
java-version: 1.8
|
||||||
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
|
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
|
||||||
username: ${{ github.actor }} # username for server authentication
|
server-username: ${{ github.actor }} # username for server authentication
|
||||||
password: ${{ github.token }} # password or token for authentication
|
server-password: ${{ github.token }} # password or token for authentication
|
||||||
settings-path: ${{ github.workspace }} # location for the settings.xml file
|
settings-path: ${{ github.workspace }} # location for the settings.xml file
|
||||||
|
|
||||||
- name: Build with Maven
|
- name: Build with Maven
|
||||||
run: mvn -B package --file pom.xml
|
run: mvn -B package --file pom.xml
|
||||||
|
|
||||||
- name: Publish to GitHub Packages Apache Maven
|
- name: Publish to GitHub Packages Apache Maven
|
||||||
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
|
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
|
||||||
```
|
```
|
||||||
|
|
|
@ -23,10 +23,10 @@ inputs:
|
||||||
description: 'ID of the distributionManagement repository in the pom.xml
|
description: 'ID of the distributionManagement repository in the pom.xml
|
||||||
file.'
|
file.'
|
||||||
required: false
|
required: false
|
||||||
username:
|
server-username:
|
||||||
description: 'Username for authentication to the Apache Maven repository.'
|
description: 'Username for authentication to the Apache Maven repository.'
|
||||||
required: false
|
required: false
|
||||||
password:
|
server-password:
|
||||||
description: 'Password or token for authentication to the Apache Maven
|
description: 'Password or token for authentication to the Apache Maven
|
||||||
repository.'
|
repository.'
|
||||||
required: false
|
required: false
|
||||||
|
|
|
@ -34,7 +34,7 @@ module.exports =
|
||||||
/******/ // the startup function
|
/******/ // the startup function
|
||||||
/******/ function startup() {
|
/******/ function startup() {
|
||||||
/******/ // Load entry module and return exports
|
/******/ // Load entry module and return exports
|
||||||
/******/ return __webpack_require__(423);
|
/******/ return __webpack_require__(811);
|
||||||
/******/ };
|
/******/ };
|
||||||
/******/
|
/******/
|
||||||
/******/ // run startup
|
/******/ // run startup
|
||||||
|
@ -2820,29 +2820,7 @@ function coerce (version, options) {
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 357:
|
/***/ 331:
|
||||||
/***/ (function(module) {
|
|
||||||
|
|
||||||
module.exports = require("assert");
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 413:
|
|
||||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
||||||
|
|
||||||
module.exports = __webpack_require__(141);
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 417:
|
|
||||||
/***/ (function(module) {
|
|
||||||
|
|
||||||
module.exports = require("crypto");
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 423:
|
|
||||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
@ -2863,38 +2841,92 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const core = __importStar(__webpack_require__(470));
|
const fs = __importStar(__webpack_require__(747));
|
||||||
const installer = __importStar(__webpack_require__(749));
|
const os = __importStar(__webpack_require__(87));
|
||||||
const auth = __importStar(__webpack_require__(827));
|
|
||||||
const path = __importStar(__webpack_require__(622));
|
const path = __importStar(__webpack_require__(622));
|
||||||
function run() {
|
const core = __importStar(__webpack_require__(470));
|
||||||
|
const io = __importStar(__webpack_require__(1));
|
||||||
|
exports.M2_DIR = '.m2';
|
||||||
|
exports.SETTINGS_FILE = 'settings.xml';
|
||||||
|
function configAuthentication(id, username, password) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
if (id && username && password) {
|
||||||
let version = core.getInput('version');
|
console.log(`creating ${exports.SETTINGS_FILE} with server-id: ${id}, username: ${username}, and a password`);
|
||||||
if (!version) {
|
// when an alternate m2 location is specified use only that location (no .m2 directory)
|
||||||
version = core.getInput('java-version', { required: true });
|
// otherwise use the home/.m2/ path
|
||||||
}
|
const directory = path.join(core.getInput('settings-path') || os.homedir(), core.getInput('settings-path') ? '' : exports.M2_DIR);
|
||||||
const arch = core.getInput('architecture', { required: true });
|
yield io.mkdirP(directory);
|
||||||
const javaPackage = core.getInput('java-package', { required: true });
|
core.debug(`created directory ${directory}`);
|
||||||
const jdkFile = core.getInput('jdkFile', { required: false }) || '';
|
yield write(directory, generate(id, username, password));
|
||||||
yield installer.getJava(version, arch, jdkFile, javaPackage);
|
|
||||||
const matchersPath = path.join(__dirname, '..', '.github');
|
|
||||||
console.log(`##[add-matcher]${path.join(matchersPath, 'java.json')}`);
|
|
||||||
const id = core.getInput('server-id', { required: false });
|
|
||||||
const username = core.getInput('username', { required: false });
|
|
||||||
const password = core.getInput('password', { required: false });
|
|
||||||
if (id && username && password) {
|
|
||||||
yield auth.configAuthentication(id, username, password);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (error) {
|
else {
|
||||||
core.setFailed(error.message);
|
core.debug(`no ${exports.SETTINGS_FILE} without server-id: ${id}, username: ${username}, and a password`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
run();
|
exports.configAuthentication = configAuthentication;
|
||||||
|
function escapeXML(value) {
|
||||||
|
return value
|
||||||
|
.replace(/&/g, '&')
|
||||||
|
.replace(/</g, '<')
|
||||||
|
.replace(/>/g, '>')
|
||||||
|
.replace(/"/g, '"')
|
||||||
|
.replace(/'/g, ''');
|
||||||
|
}
|
||||||
|
// only exported for testing purposes
|
||||||
|
function generate(id, username, password) {
|
||||||
|
return `
|
||||||
|
<settings>
|
||||||
|
<servers>
|
||||||
|
<server>
|
||||||
|
<id>${escapeXML(id)}</id>
|
||||||
|
<username>${escapeXML(username)}</username>
|
||||||
|
<password>${escapeXML(password)}</password>
|
||||||
|
</server>
|
||||||
|
</servers>
|
||||||
|
</settings>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
exports.generate = generate;
|
||||||
|
function write(directory, settings) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const location = path.join(directory, exports.SETTINGS_FILE);
|
||||||
|
if (fs.existsSync(location)) {
|
||||||
|
console.warn(`overwriting existing file ${location}`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
console.log(`writing ${location}`);
|
||||||
|
}
|
||||||
|
return fs.writeFileSync(location, settings, {
|
||||||
|
encoding: 'utf-8',
|
||||||
|
flag: 'w'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 357:
|
||||||
|
/***/ (function(module) {
|
||||||
|
|
||||||
|
module.exports = require("assert");
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 413:
|
||||||
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
|
module.exports = __webpack_require__(141);
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 417:
|
||||||
|
/***/ (function(module) {
|
||||||
|
|
||||||
|
module.exports = require("crypto");
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 431:
|
/***/ 431:
|
||||||
|
@ -3810,7 +3842,7 @@ module.exports = require("fs");
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 749:
|
/***/ 811:
|
||||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
@ -3831,237 +3863,39 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
let tempDirectory = process.env['RUNNER_TEMP'] || '';
|
|
||||||
const core = __importStar(__webpack_require__(470));
|
const core = __importStar(__webpack_require__(470));
|
||||||
const io = __importStar(__webpack_require__(1));
|
const installer = __importStar(__webpack_require__(923));
|
||||||
const exec = __importStar(__webpack_require__(986));
|
const auth = __importStar(__webpack_require__(331));
|
||||||
const tc = __importStar(__webpack_require__(533));
|
|
||||||
const fs = __importStar(__webpack_require__(747));
|
|
||||||
const path = __importStar(__webpack_require__(622));
|
const path = __importStar(__webpack_require__(622));
|
||||||
const semver = __importStar(__webpack_require__(280));
|
function run() {
|
||||||
const httpm = __importStar(__webpack_require__(874));
|
|
||||||
const IS_WINDOWS = process.platform === 'win32';
|
|
||||||
if (!tempDirectory) {
|
|
||||||
let baseLocation;
|
|
||||||
if (IS_WINDOWS) {
|
|
||||||
// On windows use the USERPROFILE env variable
|
|
||||||
baseLocation = process.env['USERPROFILE'] || 'C:\\';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (process.platform === 'darwin') {
|
|
||||||
baseLocation = '/Users';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
baseLocation = '/home';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
tempDirectory = path.join(baseLocation, 'actions', 'temp');
|
|
||||||
}
|
|
||||||
function getJava(version, arch, jdkFile, javaPackage) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
let toolPath = tc.find(javaPackage, version);
|
try {
|
||||||
if (toolPath) {
|
let version = core.getInput('version');
|
||||||
core.debug(`Tool found in cache ${toolPath}`);
|
if (!version) {
|
||||||
}
|
version = core.getInput('java-version', { required: true });
|
||||||
else {
|
|
||||||
let compressedFileExtension = '';
|
|
||||||
if (!jdkFile) {
|
|
||||||
core.debug('Downloading Jdk from Azul');
|
|
||||||
let http = new httpm.HttpClient('setup-java');
|
|
||||||
let contents = yield (yield http.get('https://static.azul.com/zulu/bin/')).readBody();
|
|
||||||
let refs = contents.match(/<a href.*\">/gi) || [];
|
|
||||||
const downloadInfo = getDownloadInfo(refs, version, javaPackage);
|
|
||||||
jdkFile = yield tc.downloadTool(downloadInfo.url);
|
|
||||||
version = downloadInfo.version;
|
|
||||||
compressedFileExtension = IS_WINDOWS ? '.zip' : '.tar.gz';
|
|
||||||
}
|
}
|
||||||
else {
|
const arch = core.getInput('architecture', { required: true });
|
||||||
core.debug('Retrieving Jdk from local path');
|
const javaPackage = core.getInput('java-package', { required: true });
|
||||||
|
const jdkFile = core.getInput('jdkFile', { required: false }) || '';
|
||||||
|
yield installer.getJava(version, arch, jdkFile, javaPackage);
|
||||||
|
const matchersPath = path.join(__dirname, '..', '.github');
|
||||||
|
console.log(`##[add-matcher]${path.join(matchersPath, 'java.json')}`);
|
||||||
|
const id = core.getInput('server-id', { required: false });
|
||||||
|
const username = core.getInput('server-username', { required: false });
|
||||||
|
const password = core.getInput('server-password', { required: false });
|
||||||
|
if (id && username && password) {
|
||||||
|
yield auth.configAuthentication(id, username, password);
|
||||||
}
|
}
|
||||||
compressedFileExtension = compressedFileExtension || getFileEnding(jdkFile);
|
else if (id || username || password) {
|
||||||
let tempDir = path.join(tempDirectory, 'temp_' + Math.floor(Math.random() * 2000000000));
|
console.warn('All 3 server-(id, username, and password) are required.');
|
||||||
const jdkDir = yield unzipJavaDownload(jdkFile, compressedFileExtension, tempDir);
|
|
||||||
core.debug(`jdk extracted to ${jdkDir}`);
|
|
||||||
toolPath = yield tc.cacheDir(jdkDir, javaPackage, getCacheVersionString(version), arch);
|
|
||||||
}
|
|
||||||
let extendedJavaHome = 'JAVA_HOME_' + version + '_' + arch;
|
|
||||||
core.exportVariable('JAVA_HOME', toolPath);
|
|
||||||
core.exportVariable(extendedJavaHome, toolPath);
|
|
||||||
core.addPath(path.join(toolPath, 'bin'));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.getJava = getJava;
|
|
||||||
function getCacheVersionString(version) {
|
|
||||||
const versionArray = version.split('.');
|
|
||||||
const major = versionArray[0];
|
|
||||||
const minor = versionArray.length > 1 ? versionArray[1] : '0';
|
|
||||||
const patch = versionArray.length > 2 ? versionArray[2] : '0';
|
|
||||||
return `${major}.${minor}.${patch}`;
|
|
||||||
}
|
|
||||||
function getFileEnding(file) {
|
|
||||||
let fileEnding = '';
|
|
||||||
if (file.endsWith('.tar')) {
|
|
||||||
fileEnding = '.tar';
|
|
||||||
}
|
|
||||||
else if (file.endsWith('.tar.gz')) {
|
|
||||||
fileEnding = '.tar.gz';
|
|
||||||
}
|
|
||||||
else if (file.endsWith('.zip')) {
|
|
||||||
fileEnding = '.zip';
|
|
||||||
}
|
|
||||||
else if (file.endsWith('.7z')) {
|
|
||||||
fileEnding = '.7z';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw new Error(`${file} has an unsupported file extension`);
|
|
||||||
}
|
|
||||||
return fileEnding;
|
|
||||||
}
|
|
||||||
function extractFiles(file, fileEnding, destinationFolder) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
const stats = fs.statSync(file);
|
|
||||||
if (!stats) {
|
|
||||||
throw new Error(`Failed to extract ${file} - it doesn't exist`);
|
|
||||||
}
|
|
||||||
else if (stats.isDirectory()) {
|
|
||||||
throw new Error(`Failed to extract ${file} - it is a directory`);
|
|
||||||
}
|
|
||||||
if ('.tar' === fileEnding || '.tar.gz' === fileEnding) {
|
|
||||||
yield tc.extractTar(file, destinationFolder);
|
|
||||||
}
|
|
||||||
else if ('.zip' === fileEnding) {
|
|
||||||
yield tc.extractZip(file, destinationFolder);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// fall through and use sevenZip
|
|
||||||
yield tc.extract7z(file, destinationFolder);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// This method recursively finds all .pack files under fsPath and unpacks them with the unpack200 tool
|
|
||||||
function unpackJars(fsPath, javaBinPath) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
if (fs.existsSync(fsPath)) {
|
|
||||||
if (fs.lstatSync(fsPath).isDirectory()) {
|
|
||||||
for (const file in fs.readdirSync(fsPath)) {
|
|
||||||
const curPath = path.join(fsPath, file);
|
|
||||||
yield unpackJars(curPath, javaBinPath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (path.extname(fsPath).toLowerCase() === '.pack') {
|
|
||||||
// Unpack the pack file synchonously
|
|
||||||
const p = path.parse(fsPath);
|
|
||||||
const toolName = IS_WINDOWS ? 'unpack200.exe' : 'unpack200';
|
|
||||||
const args = IS_WINDOWS ? '-r -v -l ""' : '';
|
|
||||||
const name = path.join(p.dir, p.name);
|
|
||||||
yield exec.exec(`"${path.join(javaBinPath, toolName)}"`, [
|
|
||||||
`${args} "${name}.pack" "${name}.jar"`
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
catch (error) {
|
||||||
}
|
core.setFailed(error.message);
|
||||||
function unzipJavaDownload(repoRoot, fileEnding, destinationFolder, extension) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
// Create the destination folder if it doesn't exist
|
|
||||||
yield io.mkdirP(destinationFolder);
|
|
||||||
const jdkFile = path.normalize(repoRoot);
|
|
||||||
const stats = fs.statSync(jdkFile);
|
|
||||||
if (stats.isFile()) {
|
|
||||||
yield extractFiles(jdkFile, fileEnding, destinationFolder);
|
|
||||||
const jdkDirectory = path.join(destinationFolder, fs.readdirSync(destinationFolder)[0]);
|
|
||||||
yield unpackJars(jdkDirectory, path.join(jdkDirectory, 'bin'));
|
|
||||||
return jdkDirectory;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw new Error(`Jdk argument ${jdkFile} is not a file`);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function getDownloadInfo(refs, version, javaPackage) {
|
run();
|
||||||
version = normalizeVersion(version);
|
|
||||||
let extension = '';
|
|
||||||
if (IS_WINDOWS) {
|
|
||||||
extension = `-win_x64.zip`;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (process.platform === 'darwin') {
|
|
||||||
extension = `-macosx_x64.tar.gz`;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
extension = `-linux_x64.tar.gz`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let pkgRegexp = new RegExp('');
|
|
||||||
let pkgTypeLength = 0;
|
|
||||||
if (javaPackage === 'jdk') {
|
|
||||||
pkgRegexp = /jdk.*-/gi;
|
|
||||||
pkgTypeLength = 'jdk'.length;
|
|
||||||
}
|
|
||||||
else if (javaPackage == 'jre') {
|
|
||||||
pkgRegexp = /jre.*-/gi;
|
|
||||||
pkgTypeLength = 'jre'.length;
|
|
||||||
}
|
|
||||||
else if (javaPackage == 'jdk+fx') {
|
|
||||||
pkgRegexp = /fx-jdk.*-/gi;
|
|
||||||
pkgTypeLength = 'fx-jdk'.length;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw new Error(`package argument ${javaPackage} is not in [jdk | jre | jdk+fx]`);
|
|
||||||
}
|
|
||||||
// Maps version to url
|
|
||||||
let versionMap = new Map();
|
|
||||||
// Filter by platform
|
|
||||||
refs.forEach(ref => {
|
|
||||||
if (!ref.endsWith(extension + '">')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// If we haven't returned, means we're looking at the correct platform
|
|
||||||
let versions = ref.match(pkgRegexp) || [];
|
|
||||||
if (versions.length > 1) {
|
|
||||||
throw new Error(`Invalid ref received from https://static.azul.com/zulu/bin/: ${ref}`);
|
|
||||||
}
|
|
||||||
if (versions.length == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const refVersion = versions[0].slice(pkgTypeLength, versions[0].length - 1);
|
|
||||||
if (semver.satisfies(refVersion, version)) {
|
|
||||||
versionMap.set(refVersion, 'https://static.azul.com/zulu/bin/' +
|
|
||||||
ref.slice('<a href="'.length, ref.length - '">'.length));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// Choose the most recent satisfying version
|
|
||||||
let curVersion = '0.0.0';
|
|
||||||
let curUrl = '';
|
|
||||||
for (const entry of versionMap.entries()) {
|
|
||||||
const entryVersion = entry[0];
|
|
||||||
const entryUrl = entry[1];
|
|
||||||
if (semver.gt(entryVersion, curVersion)) {
|
|
||||||
curUrl = entryUrl;
|
|
||||||
curVersion = entryVersion;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (curUrl == '') {
|
|
||||||
throw new Error(`No valid download found for version ${version} and package ${javaPackage}. Check https://static.azul.com/zulu/bin/ for a list of valid versions or download your own jdk file and add the jdkFile argument`);
|
|
||||||
}
|
|
||||||
return { version: curVersion, url: curUrl };
|
|
||||||
}
|
|
||||||
function normalizeVersion(version) {
|
|
||||||
if (version.slice(0, 2) === '1.') {
|
|
||||||
// Trim leading 1. for versions like 1.8
|
|
||||||
version = version.slice(2);
|
|
||||||
if (!version) {
|
|
||||||
throw new Error('1. is not a valid version');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Add trailing .x if it is missing
|
|
||||||
if (version.split('.').length != 3) {
|
|
||||||
if (version[version.length - 1] != 'x') {
|
|
||||||
version = version + '.x';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return version;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
@ -4100,98 +3934,6 @@ function v4(options, buf, offset) {
|
||||||
module.exports = v4;
|
module.exports = v4;
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 827:
|
|
||||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
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 });
|
|
||||||
const fs = __importStar(__webpack_require__(747));
|
|
||||||
const os = __importStar(__webpack_require__(87));
|
|
||||||
const path = __importStar(__webpack_require__(622));
|
|
||||||
const core = __importStar(__webpack_require__(470));
|
|
||||||
const io = __importStar(__webpack_require__(1));
|
|
||||||
exports.M2_DIR = '.m2';
|
|
||||||
exports.SETTINGS_FILE = 'settings.xml';
|
|
||||||
function configAuthentication(id, username, password) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
if (id && username && password) {
|
|
||||||
console.log(`creating ${exports.SETTINGS_FILE} with server-id: ${id}, username: ${username}, and a password`);
|
|
||||||
// when an alternate m2 location is specified use only that location (no .m2 directory)
|
|
||||||
// otherwise use the home/.m2/ path
|
|
||||||
const directory = path.join(core.getInput('settings-path') || os.homedir(), core.getInput('settings-path') ? '' : exports.M2_DIR);
|
|
||||||
yield io.mkdirP(directory);
|
|
||||||
core.debug(`created directory ${directory}`);
|
|
||||||
yield write(directory, generate(id, username, password));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
core.debug(`no ${exports.SETTINGS_FILE} without server-id: ${id}, username: ${username}, and a password`);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.configAuthentication = configAuthentication;
|
|
||||||
function escapeXML(value) {
|
|
||||||
return value
|
|
||||||
.replace(/&/g, '&')
|
|
||||||
.replace(/</g, '<')
|
|
||||||
.replace(/>/g, '>')
|
|
||||||
.replace(/"/g, '"')
|
|
||||||
.replace(/'/g, ''');
|
|
||||||
}
|
|
||||||
// only exported for testing purposes
|
|
||||||
function generate(id, username, password) {
|
|
||||||
return `
|
|
||||||
<settings>
|
|
||||||
<servers>
|
|
||||||
<server>
|
|
||||||
<id>${escapeXML(id)}</id>
|
|
||||||
<username>${escapeXML(username)}</username>
|
|
||||||
<password>${escapeXML(password)}</password>
|
|
||||||
</server>
|
|
||||||
</servers>
|
|
||||||
</settings>
|
|
||||||
`;
|
|
||||||
}
|
|
||||||
exports.generate = generate;
|
|
||||||
function write(directory, settings) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
const options = { encoding: 'utf-8', flag: 'wx' }; // 'wx': Like 'w' but fails if path exists
|
|
||||||
const location = path.join(directory, exports.SETTINGS_FILE);
|
|
||||||
console.log(`writing ${location}`);
|
|
||||||
try {
|
|
||||||
return fs.writeFileSync(location, settings, options);
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
if (e.code == 'EEXIST') {
|
|
||||||
console.warn(`overwriting existing file ${location}`);
|
|
||||||
return fs.writeFileSync(location, settings, {
|
|
||||||
encoding: 'utf-8',
|
|
||||||
flag: 'w'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 835:
|
/***/ 835:
|
||||||
|
@ -4662,6 +4404,262 @@ class HttpClient {
|
||||||
exports.HttpClient = HttpClient;
|
exports.HttpClient = HttpClient;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 923:
|
||||||
|
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
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 });
|
||||||
|
let tempDirectory = process.env['RUNNER_TEMP'] || '';
|
||||||
|
const core = __importStar(__webpack_require__(470));
|
||||||
|
const io = __importStar(__webpack_require__(1));
|
||||||
|
const exec = __importStar(__webpack_require__(986));
|
||||||
|
const tc = __importStar(__webpack_require__(533));
|
||||||
|
const fs = __importStar(__webpack_require__(747));
|
||||||
|
const path = __importStar(__webpack_require__(622));
|
||||||
|
const semver = __importStar(__webpack_require__(280));
|
||||||
|
const httpm = __importStar(__webpack_require__(874));
|
||||||
|
const IS_WINDOWS = process.platform === 'win32';
|
||||||
|
if (!tempDirectory) {
|
||||||
|
let baseLocation;
|
||||||
|
if (IS_WINDOWS) {
|
||||||
|
// On windows use the USERPROFILE env variable
|
||||||
|
baseLocation = process.env['USERPROFILE'] || 'C:\\';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (process.platform === 'darwin') {
|
||||||
|
baseLocation = '/Users';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
baseLocation = '/home';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tempDirectory = path.join(baseLocation, 'actions', 'temp');
|
||||||
|
}
|
||||||
|
function getJava(version, arch, jdkFile, javaPackage) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
let toolPath = tc.find(javaPackage, version);
|
||||||
|
if (toolPath) {
|
||||||
|
core.debug(`Tool found in cache ${toolPath}`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
let compressedFileExtension = '';
|
||||||
|
if (!jdkFile) {
|
||||||
|
core.debug('Downloading Jdk from Azul');
|
||||||
|
let http = new httpm.HttpClient('setup-java');
|
||||||
|
let contents = yield (yield http.get('https://static.azul.com/zulu/bin/')).readBody();
|
||||||
|
let refs = contents.match(/<a href.*\">/gi) || [];
|
||||||
|
const downloadInfo = getDownloadInfo(refs, version, javaPackage);
|
||||||
|
jdkFile = yield tc.downloadTool(downloadInfo.url);
|
||||||
|
version = downloadInfo.version;
|
||||||
|
compressedFileExtension = IS_WINDOWS ? '.zip' : '.tar.gz';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
core.debug('Retrieving Jdk from local path');
|
||||||
|
}
|
||||||
|
compressedFileExtension = compressedFileExtension || getFileEnding(jdkFile);
|
||||||
|
let tempDir = path.join(tempDirectory, 'temp_' + Math.floor(Math.random() * 2000000000));
|
||||||
|
const jdkDir = yield unzipJavaDownload(jdkFile, compressedFileExtension, tempDir);
|
||||||
|
core.debug(`jdk extracted to ${jdkDir}`);
|
||||||
|
toolPath = yield tc.cacheDir(jdkDir, javaPackage, getCacheVersionString(version), arch);
|
||||||
|
}
|
||||||
|
let extendedJavaHome = 'JAVA_HOME_' + version + '_' + arch;
|
||||||
|
core.exportVariable('JAVA_HOME', toolPath);
|
||||||
|
core.exportVariable(extendedJavaHome, toolPath);
|
||||||
|
core.addPath(path.join(toolPath, 'bin'));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.getJava = getJava;
|
||||||
|
function getCacheVersionString(version) {
|
||||||
|
const versionArray = version.split('.');
|
||||||
|
const major = versionArray[0];
|
||||||
|
const minor = versionArray.length > 1 ? versionArray[1] : '0';
|
||||||
|
const patch = versionArray.length > 2 ? versionArray[2] : '0';
|
||||||
|
return `${major}.${minor}.${patch}`;
|
||||||
|
}
|
||||||
|
function getFileEnding(file) {
|
||||||
|
let fileEnding = '';
|
||||||
|
if (file.endsWith('.tar')) {
|
||||||
|
fileEnding = '.tar';
|
||||||
|
}
|
||||||
|
else if (file.endsWith('.tar.gz')) {
|
||||||
|
fileEnding = '.tar.gz';
|
||||||
|
}
|
||||||
|
else if (file.endsWith('.zip')) {
|
||||||
|
fileEnding = '.zip';
|
||||||
|
}
|
||||||
|
else if (file.endsWith('.7z')) {
|
||||||
|
fileEnding = '.7z';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw new Error(`${file} has an unsupported file extension`);
|
||||||
|
}
|
||||||
|
return fileEnding;
|
||||||
|
}
|
||||||
|
function extractFiles(file, fileEnding, destinationFolder) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const stats = fs.statSync(file);
|
||||||
|
if (!stats) {
|
||||||
|
throw new Error(`Failed to extract ${file} - it doesn't exist`);
|
||||||
|
}
|
||||||
|
else if (stats.isDirectory()) {
|
||||||
|
throw new Error(`Failed to extract ${file} - it is a directory`);
|
||||||
|
}
|
||||||
|
if ('.tar' === fileEnding || '.tar.gz' === fileEnding) {
|
||||||
|
yield tc.extractTar(file, destinationFolder);
|
||||||
|
}
|
||||||
|
else if ('.zip' === fileEnding) {
|
||||||
|
yield tc.extractZip(file, destinationFolder);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// fall through and use sevenZip
|
||||||
|
yield tc.extract7z(file, destinationFolder);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// This method recursively finds all .pack files under fsPath and unpacks them with the unpack200 tool
|
||||||
|
function unpackJars(fsPath, javaBinPath) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
if (fs.existsSync(fsPath)) {
|
||||||
|
if (fs.lstatSync(fsPath).isDirectory()) {
|
||||||
|
for (const file in fs.readdirSync(fsPath)) {
|
||||||
|
const curPath = path.join(fsPath, file);
|
||||||
|
yield unpackJars(curPath, javaBinPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (path.extname(fsPath).toLowerCase() === '.pack') {
|
||||||
|
// Unpack the pack file synchonously
|
||||||
|
const p = path.parse(fsPath);
|
||||||
|
const toolName = IS_WINDOWS ? 'unpack200.exe' : 'unpack200';
|
||||||
|
const args = IS_WINDOWS ? '-r -v -l ""' : '';
|
||||||
|
const name = path.join(p.dir, p.name);
|
||||||
|
yield exec.exec(`"${path.join(javaBinPath, toolName)}"`, [
|
||||||
|
`${args} "${name}.pack" "${name}.jar"`
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function unzipJavaDownload(repoRoot, fileEnding, destinationFolder, extension) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
// Create the destination folder if it doesn't exist
|
||||||
|
yield io.mkdirP(destinationFolder);
|
||||||
|
const jdkFile = path.normalize(repoRoot);
|
||||||
|
const stats = fs.statSync(jdkFile);
|
||||||
|
if (stats.isFile()) {
|
||||||
|
yield extractFiles(jdkFile, fileEnding, destinationFolder);
|
||||||
|
const jdkDirectory = path.join(destinationFolder, fs.readdirSync(destinationFolder)[0]);
|
||||||
|
yield unpackJars(jdkDirectory, path.join(jdkDirectory, 'bin'));
|
||||||
|
return jdkDirectory;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw new Error(`Jdk argument ${jdkFile} is not a file`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function getDownloadInfo(refs, version, javaPackage) {
|
||||||
|
version = normalizeVersion(version);
|
||||||
|
let extension = '';
|
||||||
|
if (IS_WINDOWS) {
|
||||||
|
extension = `-win_x64.zip`;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (process.platform === 'darwin') {
|
||||||
|
extension = `-macosx_x64.tar.gz`;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
extension = `-linux_x64.tar.gz`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let pkgRegexp = new RegExp('');
|
||||||
|
let pkgTypeLength = 0;
|
||||||
|
if (javaPackage === 'jdk') {
|
||||||
|
pkgRegexp = /jdk.*-/gi;
|
||||||
|
pkgTypeLength = 'jdk'.length;
|
||||||
|
}
|
||||||
|
else if (javaPackage == 'jre') {
|
||||||
|
pkgRegexp = /jre.*-/gi;
|
||||||
|
pkgTypeLength = 'jre'.length;
|
||||||
|
}
|
||||||
|
else if (javaPackage == 'jdk+fx') {
|
||||||
|
pkgRegexp = /fx-jdk.*-/gi;
|
||||||
|
pkgTypeLength = 'fx-jdk'.length;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw new Error(`package argument ${javaPackage} is not in [jdk | jre | jdk+fx]`);
|
||||||
|
}
|
||||||
|
// Maps version to url
|
||||||
|
let versionMap = new Map();
|
||||||
|
// Filter by platform
|
||||||
|
refs.forEach(ref => {
|
||||||
|
if (!ref.endsWith(extension + '">')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// If we haven't returned, means we're looking at the correct platform
|
||||||
|
let versions = ref.match(pkgRegexp) || [];
|
||||||
|
if (versions.length > 1) {
|
||||||
|
throw new Error(`Invalid ref received from https://static.azul.com/zulu/bin/: ${ref}`);
|
||||||
|
}
|
||||||
|
if (versions.length == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const refVersion = versions[0].slice(pkgTypeLength, versions[0].length - 1);
|
||||||
|
if (semver.satisfies(refVersion, version)) {
|
||||||
|
versionMap.set(refVersion, 'https://static.azul.com/zulu/bin/' +
|
||||||
|
ref.slice('<a href="'.length, ref.length - '">'.length));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// Choose the most recent satisfying version
|
||||||
|
let curVersion = '0.0.0';
|
||||||
|
let curUrl = '';
|
||||||
|
for (const entry of versionMap.entries()) {
|
||||||
|
const entryVersion = entry[0];
|
||||||
|
const entryUrl = entry[1];
|
||||||
|
if (semver.gt(entryVersion, curVersion)) {
|
||||||
|
curUrl = entryUrl;
|
||||||
|
curVersion = entryVersion;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (curUrl == '') {
|
||||||
|
throw new Error(`No valid download found for version ${version} and package ${javaPackage}. Check https://static.azul.com/zulu/bin/ for a list of valid versions or download your own jdk file and add the jdkFile argument`);
|
||||||
|
}
|
||||||
|
return { version: curVersion, url: curUrl };
|
||||||
|
}
|
||||||
|
function normalizeVersion(version) {
|
||||||
|
if (version.slice(0, 2) === '1.') {
|
||||||
|
// Trim leading 1. for versions like 1.8
|
||||||
|
version = version.slice(2);
|
||||||
|
if (!version) {
|
||||||
|
throw new Error('1. is not a valid version');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Add trailing .x if it is missing
|
||||||
|
if (version.split('.').length != 3) {
|
||||||
|
if (version[version.length - 1] != 'x') {
|
||||||
|
version = version + '.x';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 986:
|
/***/ 986:
|
||||||
|
|
|
@ -5,10 +5,11 @@
|
||||||
"description": "setup java action",
|
"description": "setup java action",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"build": "ncc build src/setup-java.ts",
|
||||||
"format": "prettier --write **/*.ts",
|
"format": "prettier --write **/*.ts",
|
||||||
"format-check": "prettier --check **/*.ts",
|
"format-check": "prettier --check **/*.ts",
|
||||||
"release": "ncc build lib/setup-java.js && git add -f dist/index.js",
|
"prerelease": "npm run-script build",
|
||||||
|
"release": "git add -f dist/index.js",
|
||||||
"test": "jest"
|
"test": "jest"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
22
src/auth.ts
22
src/auth.ts
|
@ -57,19 +57,15 @@ export function generate(id: string, username: string, password: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function write(directory: string, settings: string) {
|
async function write(directory: string, settings: string) {
|
||||||
const options = {encoding: 'utf-8', flag: 'wx'}; // 'wx': Like 'w' but fails if path exists
|
|
||||||
const location = path.join(directory, SETTINGS_FILE);
|
const location = path.join(directory, SETTINGS_FILE);
|
||||||
console.log(`writing ${location}`);
|
if (fs.existsSync(location)) {
|
||||||
try {
|
console.warn(`overwriting existing file ${location}`);
|
||||||
return fs.writeFileSync(location, settings, options);
|
} else {
|
||||||
} catch (e) {
|
console.log(`writing ${location}`);
|
||||||
if (e.code == 'EEXIST') {
|
|
||||||
console.warn(`overwriting existing file ${location}`);
|
|
||||||
return fs.writeFileSync(location, settings, {
|
|
||||||
encoding: 'utf-8',
|
|
||||||
flag: 'w'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
throw e;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return fs.writeFileSync(location, settings, {
|
||||||
|
encoding: 'utf-8',
|
||||||
|
flag: 'w'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,11 +19,13 @@ async function run() {
|
||||||
console.log(`##[add-matcher]${path.join(matchersPath, 'java.json')}`);
|
console.log(`##[add-matcher]${path.join(matchersPath, 'java.json')}`);
|
||||||
|
|
||||||
const id = core.getInput('server-id', {required: false});
|
const id = core.getInput('server-id', {required: false});
|
||||||
const username = core.getInput('username', {required: false});
|
const username = core.getInput('server-username', {required: false});
|
||||||
const password = core.getInput('password', {required: false});
|
const password = core.getInput('server-password', {required: false});
|
||||||
|
|
||||||
if (id && username && password) {
|
if (id && username && password) {
|
||||||
await auth.configAuthentication(id, username, password);
|
await auth.configAuthentication(id, username, password);
|
||||||
|
} else if (id || username || password) {
|
||||||
|
console.warn('All 3 server-(id, username, and password) are required.');
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
|
|
Loading…
Reference in New Issue