Skip to content

Commit 9bc9c5e

Browse files
committed
Update ci.yml
1 parent d2aeca3 commit 9bc9c5e

File tree

1 file changed

+17
-25
lines changed

1 file changed

+17
-25
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: CI
33
on:
44
- push
55
- pull_request
6-
- workflow_dispatch # Allow manual trigger from GitHub UI
6+
- workflow_dispatch
77

88
jobs:
99
build:
@@ -30,17 +30,25 @@ jobs:
3030
id: discover-submodules
3131
run: |
3232
sudo node ./scripts/discover-submodules.js > submodules.json
33-
echo "::set-output name=submodule-matrix::$(cat submodules.json)" # Set the output here
3433
35-
echo "Submodule matrix:"
34+
echo "Original Submodule JSON content:"
3635
cat submodules.json
3736
37+
# Transform JSON into a list of 'owner/repo' strings
38+
jq -c '[.[] | "\(.owner)/\(.repo)"]' submodules.json > transformed-submodules.json
39+
40+
echo "Transformed Submodule JSON content:"
41+
cat transformed-submodules.json
42+
43+
# Set the output for the submodule matrix
44+
echo "::set-output name=submodule-matrix::$(cat transformed-submodules.json)"
45+
3846
process-plugin:
3947
needs: build
4048
runs-on: ubuntu-latest
4149
strategy:
4250
matrix:
43-
repository: ${{ fromJson(needs.build.outputs.submodule-matrix) }} # Now properly access the output
51+
repository: ${{ fromJson(needs.build.outputs.submodule-matrix) }}
4452
steps:
4553
- name: Checkout specific submodule repository
4654
uses: actions/checkout@v2
@@ -59,27 +67,16 @@ jobs:
5967

6068
- name: Install dependencies and build plugin
6169
run: |
62-
echo "Available directories:"
63-
ls -l # List contents of the current directory to verify submodule checkout
64-
6570
cd ${{ matrix.repository }}
66-
echo "Changed directory to ${{ matrix.repository }}"
67-
68-
# Check if the directory exists before trying to run pnpm
69-
if [ -d "$PWD" ]; then
70-
pnpm install
71-
pnpm run build
72-
else
73-
echo "Error: Directory ${{ matrix.repository }} does not exist!"
74-
exit 1 # Fail the job if the directory does not exist
75-
fi
71+
pnpm install
72+
pnpm run build
7673
env:
7774
NODE_ENV: production
7875

7976
- name: Copy files to dist
8077
run: |
81-
repo_name="${{ matrix.repository }}" # Use the repo name
82-
repo_name=${repo_name##*/} # Extract the repo name from the full path
78+
repo_name="${{ matrix.repository }}"
79+
repo_name=${repo_name##*/} # Extract the repo name
8380
mkdir -p dist/"$repo_name"
8481
8582
cp -r "$repo_name/plugin.json" dist/"$repo_name"/plugin.json
@@ -88,14 +85,11 @@ jobs:
8885
cp -r "$repo_name/README" dist/"$repo_name"/README || true
8986
9087
cd "$repo_name"
91-
92-
# Handle backend
9388
backend=$(jq -r '.backend' plugin.json)
9489
if [ "$backend" != "null" ]; then
9590
cp -r "$backend" ../../dist/"$repo_name"/"$backend"
9691
fi
9792
98-
# Handle include files
9993
include=$(jq -r '.include | join(" ")' plugin.json)
10094
if [ -n "$include" ]; then
10195
for file in $include; do
@@ -104,14 +98,12 @@ jobs:
10498
fi
10599
106100
cd ../..
107-
108-
# Add metadata
109101
echo "{\"commit\": \"$(git rev-parse HEAD)\", \"id\": \"$(git rev-list --max-parents=0 HEAD)\"}" > dist/"$repo_name"/metadata.json
110102
111103
- name: Zip the plugin
112104
run: |
113105
repo_name="${{ matrix.repository }}"
114-
repo_name=${repo_name##*/} # Extract the repo name from the full path
106+
repo_name=${repo_name##*/} # Extract the repo name
115107
mkdir -p build
116108
cd dist
117109
zip -r "$repo_name.zip" "$repo_name"

0 commit comments

Comments
 (0)