44 - push
55 - pull_request
66 - workflow_dispatch # Allow manual trigger from GitHub UI
7-
7+
88jobs :
99 build :
1010 runs-on : ubuntu-latest
1111 outputs :
12- plugin -matrix : ${{ steps.discover-plugins .outputs.plugin -matrix }}
12+ submodule -matrix : ${{ steps.discover-submodules .outputs.submodule -matrix }}
1313 steps :
1414 - name : Checkout repository
1515 uses : actions/checkout@v2
@@ -26,25 +26,26 @@ jobs:
2626 - name : Install pnpm
2727 run : npm install -g pnpm
2828
29- - name : Discover plugins
30- id : discover-plugins
29+ - name : Discover submodules
30+ id : discover-submodules
3131 run : |
32- plugins =$(find plugins/* -type d -maxdepth 0 )
33- matrix=$(echo "$plugins " | jq -R -s -c 'split("\n")[:-1] | map({ plugin : . })')
34- echo "Matrix: $matrix"
35- echo "::set-output name=plugin -matrix::$matrix"
32+ submodules =$(git submodule status --recursive | awk '{ print $2 }' )
33+ matrix=$(echo "$submodules " | jq -R -s -c 'split("\n")[:-1] | map({ repository : . })')
34+ echo "Submodule Matrix: $matrix"
35+ echo "::set-output name=submodule -matrix::$matrix"
3636
3737 process-plugin :
3838 needs : build
3939 runs-on : ubuntu-latest
4040 strategy :
4141 matrix :
42- plugin : ${{ fromJson(needs.build.outputs.plugin -matrix) }}
42+ repository : ${{ fromJson(needs.build.outputs.submodule -matrix) }}
4343 steps :
44- - name : Checkout repository
44+ - name : Checkout specific submodule repository
4545 uses : actions/checkout@v2
4646 with :
47- submodules : recursive
47+ repository : ${{ matrix.repository }}
48+ token : ${{ secrets.GITHUB_TOKEN }}
4849 fetch-depth : 0
4950
5051 - name : Set up Node.js
@@ -58,62 +59,62 @@ jobs:
5859 - name : Install dependencies and build plugin
5960 run : |
6061 echo "Available directories:"
61- ls -l # This will list the directories in the current working directory
62+ ls -l # List contents of the current directory to verify submodule checkout
6263
63- cd ${{ matrix.plugin }}
64- echo "Changed directory to ${{ matrix.plugin }}"
64+ cd ${{ matrix.repository }}
65+ echo "Changed directory to ${{ matrix.repository }}"
6566
6667 # Check if the directory exists before trying to run pnpm
6768 if [ -d "$PWD" ]; then
6869 pnpm install
6970 pnpm run build
7071 else
71- echo "Error: Directory ${{ matrix.plugin }} does not exist!"
72+ echo "Error: Directory ${{ matrix.repository }} does not exist!"
7273 exit 1 # Fail the job if the directory does not exist
7374 fi
7475 env :
7576 NODE_ENV : production
7677
7778 - name : Copy files to dist
7879 run : |
79- plugin_dir ="${{ matrix.plugin }}" # Use the full plugin path
80- plugin_dir =${plugin_dir ##*/} # Extract the plugin folder name
81- mkdir -p dist/"$plugin_dir "
80+ repo_name ="${{ matrix.repository }}" # Use the repo name
81+ repo_name =${repo_name ##*/} # Extract the repo name from the full path
82+ mkdir -p dist/"$repo_name "
8283
83- cp -r "${{ matrix.plugin }} /plugin.json" dist/"$plugin_dir "/plugin.json
84- cp -r "${{ matrix.plugin }} /requirements.txt" dist/"$plugin_dir "/requirements.txt
85- cp -r "${{ matrix.plugin }} /README.md" dist/"$plugin_dir "/README.md || true
86- cp -r "${{ matrix.plugin }} /README" dist/"$plugin_dir "/README || true
84+ cp -r "$repo_name /plugin.json" dist/"$repo_name "/plugin.json
85+ cp -r "$repo_name /requirements.txt" dist/"$repo_name "/requirements.txt
86+ cp -r "$repo_name /README.md" dist/"$repo_name "/README.md || true
87+ cp -r "$repo_name /README" dist/"$repo_name "/README || true
8788
88- cd "${{ matrix.plugin }} "
89+ cd "$repo_name "
8990
9091 # Handle backend
9192 backend=$(jq -r '.backend' plugin.json)
9293 if [ "$backend" != "null" ]; then
93- cp -r "$backend" ../../dist/"$plugin_dir "/"$backend"
94+ cp -r "$backend" ../../dist/"$repo_name "/"$backend"
9495 fi
9596
9697 # Handle include files
9798 include=$(jq -r '.include | join(" ")' plugin.json)
9899 if [ -n "$include" ]; then
99100 for file in $include; do
100- cp -r "$file" ../../dist/"$plugin_dir "/"$file"
101+ cp -r "$file" ../../dist/"$repo_name "/"$file"
101102 done
102103 fi
103104
104105 cd ../..
105106
106107 # Add metadata
107- echo "{\"commit\": \"$(git rev-parse HEAD)\", \"id\": \"$(git rev-list --max-parents=0 HEAD)\"}" > dist/"$plugin_dir "/metadata.json
108+ echo "{\"commit\": \"$(git rev-parse HEAD)\", \"id\": \"$(git rev-list --max-parents=0 HEAD)\"}" > dist/"$repo_name "/metadata.json
108109
109110 - name : Zip the plugin
110111 run : |
111- plugin_dir ="${{ matrix.plugin }}"
112- plugin_dir =${plugin_dir ##*/} # Extract the plugin folder name
112+ repo_name ="${{ matrix.repository }}"
113+ repo_name =${repo_name ##*/} # Extract the repo name from the full path
113114 mkdir -p build
114115 cd dist
115- zip -r "$plugin_dir .zip" "$plugin_dir "
116- mv "$plugin_dir .zip" ../build/"$plugin_dir .zip"
116+ zip -r "$repo_name .zip" "$repo_name "
117+ mv "$repo_name .zip" ../build/"$repo_name .zip"
117118
118119 finalize :
119120 needs : process-plugin
0 commit comments