Last active
April 7, 2021 13:22
-
-
Save dbjpanda/ff8e063e1aabf5f4715a4680b6e711db to your computer and use it in GitHub Desktop.
Deploy to Freemius
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once getenv('HOME') . '/freemius-php-sdk/freemius/FreemiusBase.php'; | |
require_once getenv('HOME') . '/freemius-php-sdk/freemius/Freemius.php'; | |
define( 'FS__API_SCOPE', getenv( 'SCOPE' ) ); | |
define( 'FS__API_DEV_ID', getenv( 'DEV_ID' ) ); | |
define( 'FS__API_PUBLIC_KEY', getenv( 'PUBLIC_KEY' ) ); | |
define( 'FS__API_SECRET_KEY', getenv('SECRET_KEY' ) ); | |
define( 'FS__PLUGIN_ID', getenv('PLUGIN_ID' ) ); | |
try { | |
$api = new Freemius_Api(FS__API_SCOPE, FS__API_DEV_ID, FS__API_PUBLIC_KEY, FS__API_SECRET_KEY); | |
$deploy = $api->Api('plugins/'. FS__PLUGIN_ID .'/tags.json', 'POST', | |
[ | |
'add_contributor' => true, | |
], | |
[ | |
'file' => getenv('HOME') . '/package.zip' | |
] | |
); | |
if (!property_exists($deploy, 'id')) { | |
print_r($deploy); | |
die(); | |
} | |
echo "- Deploy done on Freemius\n"; | |
$release_mode = getenv('RELEASE_MODE'); | |
$is_released = $api->Api('plugins/'.FS__PLUGIN_ID.'/tags/'.$deploy->id.'.json', 'PUT', array( | |
'release_mode' => $release_mode | |
), array()); | |
echo "- Release mode set to " . $release_mode . '\n'; | |
} | |
catch ( Exception $e ){ | |
echo "- Something went wrong\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment