mirror of
https://github.com/LBRYFoundation/lbry.com.git
synced 2025-08-23 17:47:26 +00:00
working deploy + sass compile test
This commit is contained in:
parent
23d51a29f8
commit
b06fb57ef7
6 changed files with 48 additions and 12 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,4 +1,4 @@
|
||||||
/web/.sass-cache
|
.sass-cache
|
||||||
/web/css
|
/web/css
|
||||||
/log
|
/log
|
||||||
/data/secret
|
/data/secret
|
||||||
|
|
|
@ -35,11 +35,21 @@ class Actions
|
||||||
|
|
||||||
public function executePostCommit()
|
public function executePostCommit()
|
||||||
{
|
{
|
||||||
$payload = json_decode($_REQUEST['payload']);
|
$payload = json_decode($_REQUEST['payload'], true);
|
||||||
$secret = file_get_contents($_SERVER['ROOT_DIR'] . '/data/secret/github-secret');
|
$rawPost = file_get_contents('php://input');
|
||||||
$isToMaster = $payload->ref === 'refs/heads/master';
|
$secret = trim(file_get_contents($_SERVER['ROOT_DIR'] . '/data/secret/github-secret'));
|
||||||
|
|
||||||
file_put_contents($_SERVER['ROOT_DIR'] . '/log/github.txt', ($isToMaster ? 'master' : 'apprentince') . "\n$secret\n" . print_r($payload, TRUE) . print_r($_REQUEST, true));
|
$this->returnErrorIf(!isset($_SERVER['HTTP_X_HUB_SIGNATURE']), "HTTP header 'X-Hub-Signature' is missing.");
|
||||||
|
|
||||||
|
list($algo, $hash) = explode('=', $_SERVER['HTTP_X_HUB_SIGNATURE'], 2) + array('', '');
|
||||||
|
$this->returnErrorIf(!in_array($algo, hash_algos(), TRUE), 'Invalid hash algorithm "' . $algo . '"');
|
||||||
|
$this->returnErrorIf($hash !== hash_hmac($algo, $rawPost, $secret), 'Hash does not match. "' . $secret . '"' . ' algo: ' . $algo . '$');
|
||||||
|
|
||||||
|
if ($payload['ref'] === 'refs/heads/master')
|
||||||
|
{
|
||||||
|
shell_exec($_SERVER['ROOT_DIR'] . '/deploy.sh > /dev/null 2>/dev/null &');
|
||||||
|
echo "Successful post commit.";
|
||||||
|
}
|
||||||
|
|
||||||
return [null, []];
|
return [null, []];
|
||||||
}
|
}
|
||||||
|
@ -79,4 +89,18 @@ class Actions
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//this is dumb
|
||||||
|
protected function returnError($error)
|
||||||
|
{
|
||||||
|
throw new ErrorException($error);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function returnErrorIf($condition, $error)
|
||||||
|
{
|
||||||
|
if ($condition)
|
||||||
|
{
|
||||||
|
$this->returnError($error);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
11
lib/exception/ErrorException.class.php
Normal file
11
lib/exception/ErrorException.class.php
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to immediately end execution
|
||||||
|
*
|
||||||
|
* @author jeremy
|
||||||
|
*/
|
||||||
|
class StopException extends Exception
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
4
update.sh
Executable file
4
update.sh
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
git checkout master && git pull
|
||||||
|
sass --update web/scss:web/css --style compressed
|
|
@ -85,12 +85,9 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.photo-grid
|
.compile-test /*remove me*/
|
||||||
{
|
{
|
||||||
.photo-container
|
color: red;
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@media(max-width: $max-text-width + 30)
|
@media(max-width: $max-text-width + 30)
|
||||||
|
|
Loading…
Add table
Reference in a new issue