@@ -28778,54 +28778,66 @@ exports["default"] = _default;
2877828778
2877928779/***/ }),
2878028780
28781- /***/ 1751 :
28782- /***/ ((module, __unused_webpack_exports , __nccwpck_require__) => {
28781+ /***/ 1517 :
28782+ /***/ ((__unused_webpack_module, exports , __nccwpck_require__) => {
2878328783
28784+ "use strict";
28785+
28786+ Object.defineProperty(exports, "__esModule", ({ value: true }));
28787+ exports.PrintLogs = PrintLogs;
2878428788const core = __nccwpck_require__(2186);
28785- const fs = __nccwpck_require__(3292 );
28789+ const fs = __nccwpck_require__(7147 );
2878628790const excludedPaths = ['steambootstrapper', 'appcache', 'steamapps'];
28787-
2878828791async function PrintLogs(directory, clear = false) {
2878928792 core.info(directory);
2879028793 try {
28791- const files = await fs.readdir(directory, { recursive: true });
28794+ const files = await fs.promises. readdir(directory, { recursive: true });
2879228795 for (const file of files) {
2879328796 try {
2879428797 const fullPath = `${directory}/${file}`;
28795- const stat = await fs.stat(fullPath);
28796- if (!stat.isFile()) { continue; }
28797- if (!/\.(log|txt|vdf)$/.test(file)) { continue }
28798- if (excludedPaths.some(excluded => fullPath.includes(excluded))) { continue; }
28799- const logContent = await fs.readFile(fullPath, 'utf8');
28800- core.info(`::group::${file}`);
28798+ const stat = await fs.promises.stat(fullPath);
28799+ if (!stat.isFile()) {
28800+ continue;
28801+ }
28802+ if (!/\.(log|txt|vdf)$/.test(file)) {
28803+ continue;
28804+ }
28805+ if (excludedPaths.some(excluded => fullPath.includes(excluded))) {
28806+ continue;
28807+ }
28808+ const logContent = await fs.promises.readFile(fullPath, 'utf8');
28809+ core.startGroup(file);
2880128810 core.info(logContent);
28802- core.info('::endgroup::' );
28811+ core.endGroup( );
2880328812 if (clear && fullPath.includes('logs')) {
28804- await fs.unlink(fullPath);
28813+ await fs.promises. unlink(fullPath);
2880528814 }
28806- } catch (error) {
28815+ }
28816+ catch (error) {
2880728817 core.error(`Failed to read log: ${file}\n${error.message}`);
2880828818 }
2880928819 }
28810- } catch (error) {
28820+ }
28821+ catch (error) {
2881128822 core.error(`Failed to read logs in ${directory}!\n${error.message}`);
2881228823 }
2881328824}
2881428825
28815- module.exports = { PrintLogs }
28816-
2881728826
2881828827/***/ }),
2881928828
28820- /***/ 7521 :
28821- /***/ ((module, __unused_webpack_exports , __nccwpck_require__) => {
28829+ /***/ 8429 :
28830+ /***/ ((__unused_webpack_module, exports , __nccwpck_require__) => {
2882228831
28823- const path = __nccwpck_require__(1017);
28824- const core = __nccwpck_require__(2186);
28832+ "use strict";
28833+
28834+ Object.defineProperty(exports, "__esModule", ({ value: true }));
28835+ exports.Run = Run;
2882528836const tc = __nccwpck_require__(7784);
28837+ const core = __nccwpck_require__(2186);
2882628838const exec = __nccwpck_require__(1514);
28827- const fs = ( __nccwpck_require__(7147).promises );
28828-
28839+ const path = __nccwpck_require__(1017 );
28840+ const fs = __nccwpck_require__(7147);
2882928841const steamcmd = 'steamcmd';
2883028842const STEAM_CMD = 'STEAM_CMD';
2883128843const STEAM_DIR = 'STEAM_DIR';
@@ -28835,7 +28847,6 @@ const IS_MAC = process.platform === 'darwin';
2883528847const IS_WINDOWS = process.platform === 'win32';
2883628848const toolExtension = IS_WINDOWS ? '.exe' : '.sh';
2883728849const toolPath = `${steamcmd}${toolExtension}`;
28838-
2883928850async function Run() {
2884028851 const [toolDirectory, steamDir] = await findOrDownload();
2884128852 core.debug(`${STEAM_CMD} -> ${toolDirectory}`);
@@ -28845,12 +28856,11 @@ async function Run() {
2884528856 core.debug(`${STEAM_DIR} -> ${steamDir}`);
2884628857 core.exportVariable(STEAM_DIR, steamDir);
2884728858 const steam_temp = path.join(process.env.RUNNER_TEMP, '.steamworks');
28848- fs .mkdir(steam_temp);
28859+ await fs.promises .mkdir(steam_temp);
2884928860 core.debug(`${STEAM_TEMP} -> ${steam_temp}`);
2885028861 core.exportVariable(STEAM_TEMP, steam_temp);
2885128862 await exec.exec(steamcmd, ['+help', '+quit']);
2885228863}
28853-
2885428864async function findOrDownload() {
2885528865 const allVersions = tc.findAllVersions(steamcmd);
2885628866 core.debug(`Found versions: ${allVersions}`);
@@ -28870,7 +28880,8 @@ async function findOrDownload() {
2887028880 let downloadDirectory = path.join(getTempDirectory(), steamcmd);
2887128881 if (IS_WINDOWS) {
2887228882 downloadDirectory = await tc.extractZip(archivePath, downloadDirectory);
28873- } else {
28883+ }
28884+ else {
2887428885 downloadDirectory = await tc.extractTar(archivePath, downloadDirectory);
2887528886 }
2887628887 if (!downloadDirectory) {
@@ -28883,21 +28894,21 @@ async function findOrDownload() {
2888328894 tool = path.join(downloadDirectory, toolPath);
2888428895 if (IS_LINUX) {
2888528896 const exe = path.join(downloadDirectory, steamcmd);
28886- await fs.writeFile(exe, `#!/bin/bash\nexec "${tool}" "$@"`);
28887- await fs.chmod(exe, 0o755);
28897+ await fs.promises. writeFile(exe, `#!/bin/bash\nexec "${tool}" "$@"`);
28898+ await fs.promises. chmod(exe, 0o755);
2888828899 }
2888928900 const downloadVersion = await getVersion(tool);
2889028901 core.debug(`Setting tool cache: ${downloadDirectory} | ${steamcmd} | ${downloadVersion}`);
2889128902 toolDirectory = await tc.cacheDir(downloadDirectory, steamcmd, downloadVersion);
28892- } else {
28903+ }
28904+ else {
2889328905 tool = path.join(toolDirectory, toolPath);
2889428906 }
28895- fs .access(tool);
28907+ await fs.promises .access(tool);
2889628908 core.debug(`Found ${tool} in ${toolDirectory}`);
28897- const steamDir = getSteamDir(toolDirectory);
28909+ const steamDir = await getSteamDir(toolDirectory);
2889828910 return [toolDirectory, steamDir];
2889928911}
28900-
2890128912function getDownloadUrl() {
2890228913 let archiveName = undefined;
2890328914 switch (process.platform) {
@@ -28915,15 +28926,13 @@ function getDownloadUrl() {
2891528926 }
2891628927 return [`https://steamcdn-a.akamaihd.net/client/installer/${archiveName}`, archiveName];
2891728928}
28918-
2891928929function getTempDirectory() {
28920- const tempDirectory = process.env['RUNNER_TEMP'] || ''
28921- return tempDirectory
28930+ const tempDirectory = process.env['RUNNER_TEMP'] || '';
28931+ return tempDirectory;
2892228932}
28923-
2892428933async function getVersion(tool) {
2892528934 let output = '';
28926- await exec.exec(tool, ' +quit' , {
28935+ await exec.exec(tool, [` +quit`] , {
2892728936 listeners: {
2892828937 stdout: (data) => {
2892928938 output += data.toString();
@@ -28941,10 +28950,9 @@ async function getVersion(tool) {
2894128950 throw new Error('Failed to parse version');
2894228951 }
2894328952 core.debug(`Found version: ${version}`);
28944- return version
28953+ return version;
2894528954}
28946-
28947- function getSteamDir(toolDirectory) {
28955+ async function getSteamDir(toolDirectory) {
2894828956 let steamDir = undefined;
2894928957 switch (process.platform) {
2895028958 case 'linux':
@@ -28957,23 +28965,22 @@ function getSteamDir(toolDirectory) {
2895728965 steamDir = toolDirectory;
2895828966 break;
2895928967 }
28960- // check if steam directory exists and create if not
2896128968 try {
28962- fs.access(steamDir);
28963- } catch (error) {
28969+ await fs.promises.access(steamDir);
28970+ }
28971+ catch (error) {
2896428972 if (error.code === 'ENOENT') {
2896528973 core.debug(`Creating steam directory: ${steamDir}`);
28966- fs.mkdir(steamDir);
28967- } else {
28974+ await fs.promises.mkdir(steamDir);
28975+ }
28976+ else {
2896828977 throw error;
2896928978 }
2897028979 }
2897128980 core.debug(`Steam directory: ${steamDir}`);
2897228981 return steamDir;
2897328982}
2897428983
28975- module.exports = { Run }
28976-
2897728984
2897828985/***/ }),
2897928986
@@ -29057,14 +29064,6 @@ module.exports = require("fs");
2905729064
2905829065/***/ }),
2905929066
29060- /***/ 3292:
29061- /***/ ((module) => {
29062-
29063- "use strict";
29064- module.exports = require("fs/promises");
29065-
29066- /***/ }),
29067-
2906829067/***/ 3685:
2906929068/***/ ((module) => {
2907029069
@@ -30889,34 +30888,38 @@ module.exports = parseParams
3088930888/******/
3089030889/************************************************************************/
3089130890var __webpack_exports__ = {};
30892- // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk .
30891+ // This entry need to be wrapped in an IIFE because it need to be in strict mode .
3089330892(() => {
30894- const core = __nccwpck_require__(2186);
30895- const logging = __nccwpck_require__(1751);
30896- const setup = __nccwpck_require__(7521);
30893+ "use strict";
30894+ var exports = __webpack_exports__;
3089730895
30896+ Object.defineProperty(exports, "__esModule", ({ value: true }));
30897+ const core = __nccwpck_require__(2186);
30898+ const logging = __nccwpck_require__(1517);
30899+ const setup = __nccwpck_require__(8429);
3089830900const IsPost = !!core.getState('isPost');
30899-
3090030901const main = async () => {
3090130902 if (!IsPost) {
3090230903 core.saveState('isPost', 'true');
3090330904 core.info('Setup steamcmd...');
3090430905 try {
3090530906 await setup.Run();
30906- } catch (error) {
30907+ }
30908+ catch (error) {
3090730909 core.setFailed(error);
3090830910 }
30909- } else {
30911+ }
30912+ else {
3091030913 core.info('steamcmd logs:');
3091130914 await logging.PrintLogs(process.env.STEAM_TEMP);
3091230915 if (process.platform === 'win32') {
3091330916 await logging.PrintLogs(process.env.STEAM_CMD, true);
30914- } else {
30917+ }
30918+ else {
3091530919 await logging.PrintLogs(process.env.STEAM_DIR, true);
3091630920 }
3091730921 }
30918- }
30919-
30922+ };
3092030923main();
3092130924
3092230925})();
0 commit comments