mirror of
https://github.com/shivammathur/setup-php.git
synced 2025-07-23 23:29:07 +07:00
Add version to the script names while running
This commit is contained in:
@ -3,10 +3,10 @@ import {exec} from '@actions/exec/lib/exec';
|
||||
const https = require('https');
|
||||
const fs = require('fs');
|
||||
|
||||
async function get_file(filename: string) {
|
||||
async function get_file(filename: string, version: string) {
|
||||
let github_path: string =
|
||||
'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) {
|
||||
https.get(github_path + filename, function(response: any) {
|
||||
response
|
||||
@ -30,17 +30,18 @@ async function run() {
|
||||
|
||||
let os_version = process.platform;
|
||||
if (os_version == 'darwin') {
|
||||
await get_file('darwin.sh');
|
||||
await exec('sudo chmod a+x darwin.sh');
|
||||
await exec('./darwin.sh ' + version);
|
||||
await get_file('darwin.sh', version);
|
||||
await exec('sudo chmod a+x ' + version + 'darwin.sh');
|
||||
await exec('./' + version + 'darwin.sh ' + version);
|
||||
} else if (os_version == 'win32') {
|
||||
await get_file('windows.ps1');
|
||||
await exec('DIR');
|
||||
await exec('powershell .\\windows.ps1 -version ' + version);
|
||||
await get_file('windows.ps1', version);
|
||||
await exec(
|
||||
'powershell .\\' + version + 'windows.ps1 -version ' + version
|
||||
);
|
||||
} else if (os_version == 'linux') {
|
||||
await get_file('linux.sh');
|
||||
await exec('sudo chmod a+x linux.sh');
|
||||
await exec('./linux.sh ' + version);
|
||||
await get_file('linux.sh', version);
|
||||
await exec('sudo chmod a+x ' + version + 'linux.sh');
|
||||
await exec('./' + version + 'linux.sh ' + version);
|
||||
}
|
||||
} catch (err) {
|
||||
core.setFailed(err.message);
|
||||
|
Reference in New Issue
Block a user