ci: test #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | | |
CHANGED_FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | jq -R -s -c 'split("\n")[:-1] | map({path: .})') | |
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 }} |