Skip to content

ci: test

ci: test #15

name: Upload Merged Plugin
on:
push:
branches:
- main
- dev
paths-ignore:
- ".github/**"
- ".gitignore"
- "unpacked_plugin/**"
- "README.md"
- "LICENSE"
env:
REPO_NAME: langgenius/dify-plugins
jobs:
upload-merged-plugin:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Clone Marketplace Toolkit
env:
GH_TOKEN: ${{ secrets.ORG_SCOPE_GITHUB_TOKEN }}
run: |
gh repo clone langgenius/dify-marketplace-toolkit -- .scripts/
- name: Download Plugin Daemon
env:
GH_TOKEN: ${{ secrets.ORG_SCOPE_GITHUB_TOKEN }}
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 jq
- name: Get Changed Files from Push
id: get_changed_files
run: |
git log -10
CHANGED_FILES=$(git diff --name-only ${{ github.sha }} | jq -R -s -c 'split("\n")[:-1] | map({path: .})')
git diff --name-only ${{ github.sha }}
echo "CHANGED_FILES=$CHANGED_FILES" >> $GITHUB_ENV
echo "CHANGED_FILES=$CHANGED_FILES"
- name: Validate Plugin Path
env:
PR_FILES: ${{ env.CHANGED_FILES }}
run: |
if PLUGIN_PATH=$(python3 .scripts/validator/check-pkg-paths.py); then
echo $PLUGIN_PATH
echo "PLUGIN_PATH=$PLUGIN_PATH" >> $GITHUB_ENV
else
echo "Only one .difypkg file change is allowed in a single push."
exit 1
fi
- name: Upload Plugin
run: |
python3 .scripts/uploader/upload-package.py -p ${{ env.PLUGIN_PATH }} -t ${{ secrets.MARKETPLACE_TOKEN }} --plugin-daemon-path .scripts/dify-plugin-linux-amd64 -u ${{ secrets.MARKETPLACE_BASE_URL }}