Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- clean up installer files
- remove duplicate version check if already installed
  • Loading branch information
StephenHodgson authored Oct 2, 2024
1 parent 38f6fc0 commit 25b9f5d
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 16 deletions.
15 changes: 9 additions & 6 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33191,6 +33191,7 @@ const exec = __nccwpck_require__(1514);
const glob = __nccwpck_require__(8090);
const tc = __nccwpck_require__(7784);
const path = __nccwpck_require__(1017);
const fs = __nccwpck_require__(7147);
const main = async () => {
try {
run();
Expand All @@ -33206,12 +33207,12 @@ async function run() {
}
catch (error) {
await install();
}
try {
await exec.exec('cm', ['version']);
}
catch (error) {
core.error(`Failed to call cm command!\n${error}`);
try {
await exec.exec('cm', ['version']);
}
catch (error) {
core.error(`Failed to call cm command!\n${error}`);
}
}
}
function getTempDirectory() {
Expand Down Expand Up @@ -33253,6 +33254,7 @@ async function installWindows(version) {
const installerPath = path.join(getTempDirectory(), archiveName);
const downloadPath = await tc.downloadTool(url, installerPath);
await exec.exec(`cmd`, ['/c', downloadPath, '--mode', 'unattended', '--unattendedmodeui', 'none', '--disable-components', 'ideintegrations,eclipse,mylyn,intellij12']);
await fs.promises.unlink(downloadPath);
core.addPath('C:\\Program Files\\PlasticSCM5\\client');
}
async function installMac(version) {
Expand All @@ -33270,6 +33272,7 @@ async function installMac(version) {
throw new Error('Failed to find the installer package');
}
await exec.exec('sudo', ['installer', '-pkg', pkgPaths[0], '-target', '/Applications']);
await fs.promises.unlink(downloadPath);
}
async function installLinux(version) {
let installArg = 'plasticscm-cloud';
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "setup-plastic-scm",
"version": "1.0.0",
"version": "1.0.1",
"description": "A GitHub action to setup and install Plastic SCM (Unity VCS).",
"author": "buildalon",
"license": "MIT",
Expand Down
14 changes: 8 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import exec = require('@actions/exec');
import glob = require('@actions/glob');
import tc = require('@actions/tool-cache');
import path = require('path');
import fs = require('fs');

const main = async () => {
try {
Expand All @@ -19,11 +20,11 @@ async function run(): Promise<void> {
await exec.exec('cm', ['version']);
} catch (error) {
await install();
}
try {
await exec.exec('cm', ['version']);
} catch (error) {
core.error(`Failed to call cm command!\n${error}`);
try {
await exec.exec('cm', ['version']);
} catch (error) {
core.error(`Failed to call cm command!\n${error}`);
}
}
}

Expand Down Expand Up @@ -70,6 +71,7 @@ async function installWindows(version: string) {
const installerPath = path.join(getTempDirectory(), archiveName);
const downloadPath = await tc.downloadTool(url, installerPath);
await exec.exec(`cmd`, ['/c', downloadPath, '--mode', 'unattended', '--unattendedmodeui', 'none', '--disable-components', 'ideintegrations,eclipse,mylyn,intellij12']);
await fs.promises.unlink(downloadPath);
core.addPath('C:\\Program Files\\PlasticSCM5\\client');
}

Expand All @@ -82,13 +84,13 @@ async function installMac(version: string) {
const installerPath = path.join(getTempDirectory(), archiveName);
const downloadPath = await tc.downloadTool(url, installerPath);
const expandedPath = await tc.extractZip(downloadPath);
// use actions glob for the pkg file
const globber = await glob.create(path.join(expandedPath, '*.pkg'));
const pkgPaths: string[] = await globber.glob();
if (!pkgPaths || pkgPaths.length === 0) {
throw new Error('Failed to find the installer package');
}
await exec.exec('sudo', ['installer', '-pkg', pkgPaths[0], '-target', '/Applications']);
await fs.promises.unlink(downloadPath);
}

async function installLinux(version: string) {
Expand Down

0 comments on commit 25b9f5d

Please sign in to comment.