File tree Expand file tree Collapse file tree 2 files changed +47
-0
lines changed
Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change 1+ on :
2+ push :
3+ branches :
4+ - main
5+
6+ jobs :
7+ release-on-merge :
8+ runs-on : ubuntu-latest
9+ permissions :
10+ contents : write
11+ env :
12+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
13+ steps :
14+ - uses : dexwritescode/release-on-merge-action@v1
Original file line number Diff line number Diff line change @@ -24,11 +24,44 @@ public function handle()
2424
2525 $ this ->exportFieldSets ();
2626
27+ $ this ->exportCollections ();
28+
2729 $ this ->newLine ();
2830
2931 $ this ->info ('All done! ' );
3032 }
3133
34+ private function exportCollections ()
35+ {
36+ $ namespaces = collect (config ('statamic.builder.collections ' , []));
37+
38+ $ namespaces ->each (function ($ collections ): void {
39+ $ collections = collect ($ collections );
40+
41+ $ collections ->each (function ($ collection ): void {
42+ $ this ->exportCollection ($ collection );
43+ });
44+ });
45+ }
46+
47+ private function exportCollection ($ collection )
48+ {
49+ $ filesystem = Storage::build ([
50+ 'driver ' => 'local ' ,
51+ 'root ' => base_path ('resources/collections ' ),
52+ ]);
53+
54+ $ data = (new $ collection )->register ();
55+
56+ $ path = base_path ("resources/collections/ {$ data ->handle ()}.yaml " );
57+
58+ $ yaml = YAML ::dump ($ data ->toArray ());
59+
60+ $ this ->line ("Exporting collection [ {$ data ->handle ()}] to [ {$ path }] " );
61+
62+ $ filesystem ->put ("{$ data ->handle ()}.yaml " , $ yaml );
63+ }
64+
3265 private function exportBlueprints ()
3366 {
3467 $ namespaces = collect (config ('statamic.builder.blueprints ' , []));
You can’t perform that action at this time.
0 commit comments