forked from kaltura/media-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease.php
More file actions
48 lines (39 loc) · 1.54 KB
/
release.php
File metadata and controls
48 lines (39 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
require_once(__DIR__ . '/KalturaWowzaServer/build/tmp/github-php-client/GitHubClient.php');
function uploadAsset($client, $filename, $owner, $repo, $releaseId, $contentType) {
echo "Uploading asset: " . $filename . "\n";
$name = basename($filename);
$client->repos->releases->assets->upload($owner, $repo, $releaseId, $name, $contentType, $filename);
echo "Asset uploaded: $filename\n";
}
$owner = 'kaltura';
$repo = 'media-server';
$username = $argv[1];
$password = $argv[2];
$version = $argv[3];
$tag_name = "rel-$version";
// Get the tag of the latest *local* commit
$target_commitish = exec("git rev-parse HEAD 2>&1", $output, $retVal);
if ( $retVal !== 0 )
{
echo implode("\n", $output);
exit( $retVal );
}
$name = "v$version";
$body = "Release version $version";
$draft = false;
$prerelease = true;
$client = new GitHubClient();
$client->setCredentials($username, $password);
$release = $client->repos->releases->create($owner, $repo, $tag_name, $target_commitish, $name, $body, $draft, $prerelease);
/* @var $release GitHubReposRelease */
$releaseId = $release->getId();
echo "Release created with id $releaseId\n";
$jars = glob(__DIR__ . "/KalturaWowzaServer/build/tmp/artifacts/Kaltura*.jar");
foreach ($jars as $jar) {
uploadAsset($client, $jar, $owner, $repo, $releaseId,'application/java-archive');
}
//upload the zip distribution
$filePath = __DIR__ . "/KalturaWowzaServer/build/distributions/KalturaWowzaServer-install-$version.zip";
uploadAsset($client, $filePath, $owner, $repo, $releaseId,'application/zip');
exit(0);