Browse Source

Fixed #18

v1.2.0
aymm 1 year ago
parent
commit
dc76c19ebb
Signed by: phlaym GPG Key ID: A06651BAB6777237
  1. 2
      composer.json
  2. 5
      config.php.default
  3. 35
      release.php

2
composer.json

@ -1,6 +1,6 @@
{
"name": "hutattedonmyarm/dragonpolls",
"version": "0.9.1",
"version": "0.9.3",
"description": "A polling client for pnut.io",
"require": {
"hutattedonmyarm/apnuti": "@dev"

5
config.php.default

@ -8,4 +8,9 @@ return [
'app_name' => 'Playground',
'callback_url' => 'http://localhost/auth_callback.php',
'permission_scopes' => 'basic' //comma seperated string
'github_username' => '',
'github_repo' => '',
'github_token' => '',
'gitea_url' => '',
'gitea_token' => ''
];

35
release.php

@ -0,0 +1,35 @@
<?php
$config = include(__DIR__.'/config.php');
$version = json_decode(file_get_contents(__DIR__.'/composer.json'), true)['version'];
if (count($argv) < 2) {
die('Usage: ' . $argv[0] . ' <release_name>');
}
$release_name = $argv[1];
$release_name_arg = escapeshellarg($release_name);
print('Creating tag'.PHP_EOL);
$output = shell_exec("git tag -s $version -m $release_name_arg");
print($output.PHP_EOL);
print(''.PHP_EOL);
print('Pusing tag'.PHP_EOL);
$output = shell_exec('git push --tags');
print($output.PHP_EOL);
print(''.PHP_EOL);
print('Creating release on Github'.PHP_EOL);
$gh_user = $config['github_username'];
$gh_repo = $config['github_repo'];
$gh_token = $config['github_token'];
$payload = escapeshellarg('{"tag_name":"'.$version.'", "name":"'.$release_name.'"}');
$ct_header = '"Content-Type: application/json"';
$output = shell_exec("curl -X POST -H $ct_header -u $gh_user:$gh_token https://api.github.com/repos/$gh_user/$gh_repo/releases -d $payload");
print($output.PHP_EOL);
print(''.PHP_EOL);
print('Creating release on Gitea'.PHP_EOL);
$g_url = $config['gitea_url'];
$g_token = $config['gitea_token'];
$token_header = '"Authorization: token ' . $g_token . '"';
$output = shell_exec("curl -X POST -H $ct_header -H $token_header $g_url -d $payload");
print($output.PHP_EOL);
Loading…
Cancel
Save