mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-26 05:23:03 +07:00
Add version to the script names while running
This commit is contained in:
parent
8ba904fa24
commit
76bcc07458
@ -20,10 +20,10 @@ const core = __importStar(require("@actions/core"));
|
|||||||
const exec_1 = require("@actions/exec/lib/exec");
|
const exec_1 = require("@actions/exec/lib/exec");
|
||||||
const https = require('https');
|
const https = require('https');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
function get_file(filename) {
|
function get_file(filename, version) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
let github_path = 'https://raw.githubusercontent.com/shivammathur/setup-php/master/src/';
|
let github_path = 'https://raw.githubusercontent.com/shivammathur/setup-php/master/src/';
|
||||||
const file = fs.createWriteStream(filename);
|
const file = fs.createWriteStream(version + filename);
|
||||||
file.on('open', function (fd) {
|
file.on('open', function (fd) {
|
||||||
https.get(github_path + filename, function (response) {
|
https.get(github_path + filename, function (response) {
|
||||||
response
|
response
|
||||||
@ -47,19 +47,18 @@ function run() {
|
|||||||
console.log('Input: ' + version);
|
console.log('Input: ' + version);
|
||||||
let os_version = process.platform;
|
let os_version = process.platform;
|
||||||
if (os_version == 'darwin') {
|
if (os_version == 'darwin') {
|
||||||
yield get_file('darwin.sh');
|
yield get_file('darwin.sh', version);
|
||||||
yield exec_1.exec('sudo chmod a+x darwin.sh');
|
yield exec_1.exec('sudo chmod a+x ' + version + 'darwin.sh');
|
||||||
yield exec_1.exec('./darwin.sh ' + version);
|
yield exec_1.exec('./' + version + 'darwin.sh ' + version);
|
||||||
}
|
}
|
||||||
else if (os_version == 'win32') {
|
else if (os_version == 'win32') {
|
||||||
yield get_file('windows.ps1');
|
yield get_file('windows.ps1', version);
|
||||||
yield exec_1.exec('DIR');
|
yield exec_1.exec('powershell .\\' + version + 'windows.ps1 -version ' + version);
|
||||||
yield exec_1.exec('powershell .\\windows.ps1 -version ' + version);
|
|
||||||
}
|
}
|
||||||
else if (os_version == 'linux') {
|
else if (os_version == 'linux') {
|
||||||
yield get_file('linux.sh');
|
yield get_file('linux.sh', version);
|
||||||
yield exec_1.exec('sudo chmod a+x linux.sh');
|
yield exec_1.exec('sudo chmod a+x ' + version + 'linux.sh');
|
||||||
yield exec_1.exec('./linux.sh ' + version);
|
yield exec_1.exec('./' + version + 'linux.sh ' + version);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
|
@ -3,10 +3,10 @@ import {exec} from '@actions/exec/lib/exec';
|
|||||||
const https = require('https');
|
const https = require('https');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
async function get_file(filename: string) {
|
async function get_file(filename: string, version: string) {
|
||||||
let github_path: string =
|
let github_path: string =
|
||||||
'https://raw.githubusercontent.com/shivammathur/setup-php/master/src/';
|
'https://raw.githubusercontent.com/shivammathur/setup-php/master/src/';
|
||||||
const file: any = fs.createWriteStream(filename);
|
const file: any = fs.createWriteStream(version + filename);
|
||||||
file.on('open', function(fd: any) {
|
file.on('open', function(fd: any) {
|
||||||
https.get(github_path + filename, function(response: any) {
|
https.get(github_path + filename, function(response: any) {
|
||||||
response
|
response
|
||||||
@ -30,17 +30,18 @@ async function run() {
|
|||||||
|
|
||||||
let os_version = process.platform;
|
let os_version = process.platform;
|
||||||
if (os_version == 'darwin') {
|
if (os_version == 'darwin') {
|
||||||
await get_file('darwin.sh');
|
await get_file('darwin.sh', version);
|
||||||
await exec('sudo chmod a+x darwin.sh');
|
await exec('sudo chmod a+x ' + version + 'darwin.sh');
|
||||||
await exec('./darwin.sh ' + version);
|
await exec('./' + version + 'darwin.sh ' + version);
|
||||||
} else if (os_version == 'win32') {
|
} else if (os_version == 'win32') {
|
||||||
await get_file('windows.ps1');
|
await get_file('windows.ps1', version);
|
||||||
await exec('DIR');
|
await exec(
|
||||||
await exec('powershell .\\windows.ps1 -version ' + version);
|
'powershell .\\' + version + 'windows.ps1 -version ' + version
|
||||||
|
);
|
||||||
} else if (os_version == 'linux') {
|
} else if (os_version == 'linux') {
|
||||||
await get_file('linux.sh');
|
await get_file('linux.sh', version);
|
||||||
await exec('sudo chmod a+x linux.sh');
|
await exec('sudo chmod a+x ' + version + 'linux.sh');
|
||||||
await exec('./linux.sh ' + version);
|
await exec('./' + version + 'linux.sh ' + version);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
core.setFailed(err.message);
|
core.setFailed(err.message);
|
||||||
|
Loading…
Reference in New Issue
Block a user