-
Notifications
You must be signed in to change notification settings - Fork 20
92 lines (78 loc) · 2.89 KB
/
pre-check-plugin.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Pre Check Plugin
on:
pull_request:
types: [opened, synchronize, ready_for_review, review_requested, edited]
branches:
- main
- dev
paths-ignore:
- "migrations/**"
- ".scripts/**"
- ".github/**"
- ".gitignore"
- "README.md"
- "LICENSE"
env:
REPO_NAME: langgenius/dify-official-plugins
MARKETPLACE_BASE_URL: https://marketplace.dify.ai
MARKETPLACE_TOKEN: placeholder
GH_TOKEN: ${{ github.token }}
jobs:
pre-check-plugin:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Clone Marketplace Toolkit
run: |
gh repo clone langgenius/dify-marketplace-toolkit -- .scripts/
- name: Download Plugin Daemon
run: |
gh release download -R langgenius/dify-plugin-daemon --pattern "dify-plugin-linux-amd64" --dir .scripts
chmod +x .scripts/dify-plugin-linux-amd64
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.12.7
- name: Install Python Dependencies
run: |
python -m pip install --upgrade pip
pip install requests
- name: yq - portable yaml processor
uses: mikefarah/[email protected]
- name: Get PR Path
run: |
export PR_FILES=$(gh pr view -R ${{ env.REPO_NAME }} ${{ github.event.pull_request.number }} --json files --jq .files)
if PLUGIN_PATH=$(python3 .scripts/validator/check-prefix.py); then
echo $PLUGIN_PATH
echo "PLUGIN_PATH=$PLUGIN_PATH" >> $GITHUB_ENV
else
echo "PR files cross different plugin directories, skip upload."
exit 1
fi
- name: Check Plugin Manifest
run: |
# manifest.yaml author must be langgenius
if ! yq '.author' ${{ env.PLUGIN_PATH }}/manifest.yaml | grep -q "langgenius"; then
echo "!!! Plugin manifest.yaml author must be langgenius"
exit 1
fi
- name: Check Plugin Deps
run: |
if [ -f ${{ env.PLUGIN_PATH }}/requirements.txt ]; then
echo "Trying to install plugin dependencies..."
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install -r ${{ env.PLUGIN_PATH }}/requirements.txt
deactivate
fi
- name: Check Plugin Install
run: |
if [ -f ${{ env.PLUGIN_PATH }}/requirements.txt ]; then
source .venv/bin/activate
fi
export INSTALL_METHOD=aws_lambda
python3 .scripts/validator/test-plugin-install.py -d ${{ env.PLUGIN_PATH }}
- name: Check Packaging
run: |
python3 .scripts/uploader/upload-package.py -d ${{ env.PLUGIN_PATH }} -t ${{ env.MARKETPLACE_TOKEN }} --plugin-daemon-path .scripts/dify-plugin-linux-amd64 -u ${{ env.MARKETPLACE_BASE_URL }} -f --test