Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- convert to TypeScript
  • Loading branch information
StephenHodgson authored Aug 15, 2024
1 parent 5ef5f02 commit aaaaaf8
Show file tree
Hide file tree
Showing 9 changed files with 354 additions and 56 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ jobs:
matrix:
os: [ macos-latest, windows-latest ]
steps:
- name: checkout self
uses: actions/checkout@v4
- uses: actions/checkout@v4
- name: buildalon/setup-ovr-platform-util
uses: ./
- run: 'ovr-platform-util version'
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024 Buildalon: Automate Unity
Copyright (c) 2024 Virtual Maker Corporation

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Discord](https://img.shields.io/discord/939721153688264824.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/VM9cWJ9rjH) [![validate](https://github.com/buildalon/setup-ovr-platform-util/actions/workflows/validate.yml/badge.svg?branch=main&event=push)](https://github.com/buildalon/setup-ovr-platform-util/actions/workflows/validate.yml)

A GitHub Action to setup the [ovr-platform-util](https://developer.oculus.com/resources/publish-reference-platform-command-line-utility) tool command alias.
A GitHub Action to setup the [`ovr-platform-utility`](https://developer.oculus.com/resources/publish-reference-platform-command-line-utility) tool command alias.

## How to use

Expand Down
57 changes: 28 additions & 29 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33231,32 +33231,33 @@ module.exports = parseParams
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
(() => {
const semver = __nccwpck_require__(1383);
const path = __nccwpck_require__(1017);
const core = __nccwpck_require__(2186);
"use strict";
var exports = __webpack_exports__;

Object.defineProperty(exports, "__esModule", ({ value: true }));
const tc = __nccwpck_require__(7784);
const core = __nccwpck_require__(2186);
const exec = __nccwpck_require__(1514);
const fs = (__nccwpck_require__(7147).promises);

const semver = __nccwpck_require__(1383);
const path = __nccwpck_require__(1017);
const fs = __nccwpck_require__(7147);
const ovrPlatformUtil = 'ovr-platform-util';
const IS_WINDOWS = process.platform === 'win32'
const IS_MAC = process.platform === 'darwin'
const IS_WINDOWS = process.platform === 'win32';
const IS_MAC = process.platform === 'darwin';
const toolExtension = IS_WINDOWS ? '.exe' : '';
const toolPath = `${ovrPlatformUtil}${toolExtension}`;

const main = async () => {
try {
core.info(`Setting up ${ovrPlatformUtil}...`);
await setup_ovrPlatformUtil();
} catch (error) {
}
catch (error) {
core.setFailed(error);
}
}

};
main();

async function setup_ovrPlatformUtil() {
let toolDirectory = tc.find(ovrPlatformUtil, '*');
let tool = undefined;
Expand All @@ -33273,41 +33274,39 @@ async function setup_ovrPlatformUtil() {
core.debug(`Setting tool cache: ${archivePath} | ${toolPath} | ${ovrPlatformUtil} | ${downloadVersion}`);
toolDirectory = await tc.cacheFile(archivePath, toolPath, ovrPlatformUtil, downloadVersion);
tool = getExecutable(toolDirectory);
} else {
}
else {
tool = getExecutable(toolDirectory);
fs.access(tool);
fs.promises.access(tool);
core.debug(`Found ${tool} in ${toolDirectory}`);
await exec.exec(tool, 'self-update');
await exec.exec(tool, ['self-update']);
}
core.debug(`${ovrPlatformUtil} -> ${toolDirectory}`)
core.debug(`${ovrPlatformUtil} -> ${toolDirectory}`);
core.addPath(toolDirectory);
await exec.exec(ovrPlatformUtil, 'help');
await exec.exec(ovrPlatformUtil, ['help']);
}

function getDownloadUrl() {
if (IS_MAC) {
return 'https://www.oculus.com/download_app/?id=1462426033810370';
} else if (IS_WINDOWS) {
}
else if (IS_WINDOWS) {
return 'https://www.oculus.com/download_app/?id=1076686279105243';
} else {
}
else {
throw Error(`${ovrPlatformUtil} not available for ${process.platform}`);
}
}

function getTempDirectory() {
const tempDirectory = process.env['RUNNER_TEMP'] || ''
return tempDirectory
const tempDirectory = process.env['RUNNER_TEMP'] || '';
return tempDirectory;
}

function getExecutable(directory) {
return path.join(directory, toolPath);
}

async function getVersion(tool) {
const semVerRegEx = new RegExp(/([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)?/);
let output = '';

await exec.exec(tool, 'version', {
await exec.exec(tool, ['version'], {
listeners: {
stdout: (data) => {
output += data.toString();
Expand All @@ -33324,7 +33323,7 @@ async function getVersion(tool) {
if (!version) {
throw Error("Failed to find a valid version");
}
return version
return version;
}

})();
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit aaaaaf8

Please sign in to comment.