Skip to content

Commit dcbf3a1

Browse files
Merge pull request #2 from swashata/patch-1
fix: update api url to use id instead of slug
2 parents fcaffef + c104cc8 commit dcbf3a1

1 file changed

Lines changed: 7 additions & 11 deletions

File tree

deploy.php

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,14 @@
2727
die();
2828
}
2929

30-
$deploy = $api->Api('plugins/'.$_ENV['PLUGIN_SLUG'].'/tags.json', 'GET', array(
31-
'plugin_id' => $_ENV['PLUGIN_ID']
32-
));
30+
$deploy = $api->Api('plugins/'.$_ENV['PLUGIN_ID'].'/tags.json', 'GET');
3331
if ( $deploy->tags[0]->version === $version ) {
3432
$deploy = $deploy->tags[0];
3533
echo '-Package already deployed on Freemius'."\n";
3634
} else {
3735
// Upload the zip
38-
$deploy = $api->Api('plugins/'.$_ENV['PLUGIN_SLUG'].'/tags.json', 'POST', array(
39-
'add_contributor' => false,
40-
'plugin_id' => $_ENV['PLUGIN_ID']
36+
$deploy = $api->Api('plugins/'.$_ENV['PLUGIN_ID'].'/tags.json', 'POST', array(
37+
'add_contributor' => false
4138
), array(
4239
'file' => $file_name
4340
));
@@ -49,9 +46,8 @@
4946

5047
echo "- Deploy done on Freemius\n";
5148

52-
$is_released = $api->Api('plugins/'.$_ENV['PLUGIN_SLUG'].'/tags/'.$deploy->id.'.json', 'PUT', array(
53-
'release_mode' => $release_mode,
54-
'plugin_id' => $_ENV['PLUGIN_ID']
49+
$is_released = $api->Api('plugins/'.$_ENV['PLUGIN_ID'].'/tags/'.$deploy->id.'.json', 'PUT', array(
50+
'release_mode' => $release_mode
5551
), array());
5652

5753
echo "- Set as released on Freemius\n";
@@ -60,7 +56,7 @@
6056
echo "- Download Freemius free version\n";
6157

6258
// Generate url to download the zip
63-
$zip_free = $api->GetSignedUrl('plugins/'.$_ENV['PLUGIN_SLUG'].'/tags/'.$deploy->id.'.zip?plugin_id='.$_ENV['PLUGIN_ID'], array());
59+
$zip_free = $api->GetSignedUrl('plugins/'.$_ENV['PLUGIN_ID'].'/tags/'.$deploy->id.'.zip', array());
6460
$path = pathinfo($file_name);
6561
$zipname_free = $path['dirname'] . '/' . basename($file_name, '.zip');
6662
$zipname_free .= '__free.zip';
@@ -71,7 +67,7 @@
7167
echo "::set-output name=free_version::" . $zipname_free . "\n";
7268

7369
// Generate url to download the pro zip
74-
$zip_pro = $api->GetSignedUrl('plugins/'.$_ENV['PLUGIN_SLUG'].'/tags/'.$deploy->id.'.zip?is_premium=true&plugin_id='.$_ENV['PLUGIN_ID'], array());
70+
$zip_pro = $api->GetSignedUrl('plugins/'.$_ENV['PLUGIN_ID'].'/tags/'.$deploy->id.'.zip?is_premium=true', array());
7571
$path = pathinfo($file_name);
7672
$zipname_pro = $path['dirname'] . '/' . basename($file_name, '.zip');
7773
$zipname_pro .= '.zip';

0 commit comments

Comments
 (0)