@@ -68,34 +68,26 @@ jobs:
6868
6969 - name : Install dependencies and build plugin
7070 run : |
71- # list recursively all files and directories in the current directory
7271 ls -R
73-
7472 pnpm install
7573 pnpm run build
7674 env :
7775 NODE_ENV : production
7876
7977 - name : Copy files to dist
78+ id : copy-files-to-dist
8079 run : |
81-
8280 mkdir -p dist
83- ls -R
84- pwd
85-
8681 cp "plugin.json" dist/plugin.json 2>/dev/null || { echo "::error::plugin.json was not found. It is required for plugins to have."; exit 1; }
87-
8882 cp "requirements.txt" dist/requirements.txt 2>/dev/null || echo "::warning::requirements.txt not found, skipping."
8983 cp "README.md" dist/README.md 2>/dev/null || echo "::warning::README.md not found, skipping."
9084 cp "README" dist/README 2>/dev/null || echo "::warning::README not found, skipping."
9185
92- # Extract the 'backend' value and copy if it exists
9386 backend=$(jq -r '.backend' plugin.json)
9487 if [ "$backend" != "null" ]; then
9588 cp -r "$backend" ./dist/"$backend"
9689 fi
9790
98- # Extract the 'include' value, handle null or missing, and copy if any files exist
9991 include=$(jq -r '.include // empty' plugin.json)
10092 if [ -n "$include" ]; then
10193 for file in $include; do
@@ -104,17 +96,21 @@ jobs:
10496 fi
10597
10698 echo "::notice::Computing plugin metadata..."
107-
10899 echo "{\"commit\": \"$(git rev-parse HEAD)\", \"id\": \"$(git rev-list --max-parents=0 HEAD)\"}" > dist/metadata.json
109100
110- - name : Zip the plugin
111- run : |
112- repo_name="${{ matrix.repository }}"
113- repo_name=${repo_name##*/} # Extract the repo name
114- mkdir -p build
101+ id=$(jq -r '.id' dist/metadata.json)
102+ echo "::set-output name=id::$id" # Set the id as an output variable
103+
115104 cd dist
116- zip -r "$repo_name.zip" "$repo_name"
117- mv "$repo_name.zip" ../build/"$repo_name.zip"
105+ zip -r "$id.zip" .
106+
107+ echo "::notice::Successfully built plugin."
108+
109+ - name : Upload plugin
110+ uses : actions/upload-artifact@v2
111+ with :
112+ name : ${{ steps.copy-files-to-dist.outputs.id }} # Correct reference here
113+ path : dist/${{ steps.copy-files-to-dist.outputs.id }}.zip
118114
119115 finalize :
120116 needs : process-plugin
0 commit comments