File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ public function init(): void
2727
2828 public function beforeAction ($ action ): bool
2929 {
30+ // Don't allow if ephemeral, as the publish command won't create any files
3031 if (App::isEphemeral ()) {
3132 throw new Exception ('Asset bundle publishing is not supported in ephemeral environments. ' );
3233 }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace craft \cloud \cli \controllers ;
4+
5+ use Craft ;
6+ use craft \console \Controller ;
7+ use Illuminate \Support \Collection ;
8+ use samdark \log \PsrMessage ;
9+ use yii \console \ExitCode ;
10+
11+ class BuildController extends Controller
12+ {
13+ public function actionIndex (string $ json ): int
14+ {
15+ $ options = json_decode ($ json , true );
16+ $ exitCode = ExitCode::OK ;
17+
18+ Collection::make ([
19+ 'cloud/validate/project-type ' ,
20+ 'cloud/asset-bundles/publish ' ,
21+ ])->each (function (string $ command ) use ($ options , &$ exitCode ) {
22+ $ params = $ options [$ command ] ?? [];
23+ $ exitCode = $ this ->run ("/ $ command " , $ params );
24+
25+ if ($ exitCode !== ExitCode::OK ) {
26+ Craft::error (new PsrMessage ('Command failed. ' , [
27+ 'command ' => $ command ,
28+ 'params ' => $ params ,
29+ ]));
30+
31+ return false ;
32+ }
33+ });
34+
35+ return $ exitCode ;
36+ }
37+ }
You can’t perform that action at this time.
0 commit comments