Skip to content

Commit b41cf6a

Browse files
authored
Merge pull request #135 from matlab-actions/fix_130
2 parents 250e572 + f17c71c commit b41cf6a

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

.github/workflows/bat.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,12 @@ jobs:
8989
with:
9090
release: ${{ matrix.release }}
9191
products: ${{ matrix.products }}
92+
- name: Call setup MATLAB again with different release # should not error as in issue 130
93+
uses: ./
94+
with:
95+
release: R2023b
96+
- name: Check MATLAB version
97+
uses: matlab-actions/run-command@v2
98+
with:
99+
command: matlabVer = ver('matlab'); assert(strcmp(matlabVer.Release,'(R2023b)'));
100+

src/mpm.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import * as exec from "@actions/exec";
44
import * as tc from "@actions/tool-cache";
55
import {rmRF} from "@actions/io";
66
import * as path from "path";
7+
import * as fs from 'fs';
78
import * as matlab from "./matlab";
89
import properties from "./properties.json";
910

@@ -37,6 +38,16 @@ export async function setup(platform: string, architecture: string): Promise<str
3738
return Promise.reject(Error("Unable to find runner temporary directory."));
3839
}
3940
let mpmDest = path.join(runner_temp, `mpm${ext}`);
41+
42+
// Delete mpm file if it exists
43+
if (fs.existsSync(mpmDest)) {
44+
try {
45+
fs.unlinkSync(mpmDest);
46+
} catch (err) {
47+
return Promise.reject(Error(`Failed to delete existing mpm file: ${err}`));
48+
}
49+
}
50+
4051
let mpm: string = await tc.downloadTool(mpmUrl, mpmDest);
4152

4253
if (platform !== "win32") {

0 commit comments

Comments
 (0)