Skip to content

Commit

Permalink
ci: check author and version
Browse files Browse the repository at this point in the history
  • Loading branch information
RockChinQ committed Dec 18, 2024
1 parent 40609a3 commit 8f5f2fd
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
27 changes: 26 additions & 1 deletion .github/workflows/pre-check-plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,37 @@ jobs:
- name: Check Plugin Manifest
run: |
# manifest.yaml author must be langgenius
# manifest.yaml author must not be langgenius
if yq '.author' ${{ env.PLUGIN_PATH }}/manifest.yaml | grep -q "langgenius"; then
echo "!!! Plugin manifest.yaml author must not be 'langgenius'"
exit 1
fi
# author must equal to the pr author (lowercase)
if [ "$(yq '.author' ${{ env.PLUGIN_PATH }}/manifest.yaml)" != "$(gh pr view -R ${{ env.REPO_NAME }} ${{ github.event.pull_request.number }} --json author --jq .author.login | tr '[:upper:]' '[:lower:]')" ]; then
echo "!!! Plugin manifest.yaml author should be lowercase and must be the same as the PR author"
exit 1
fi
- name: Check If Version Exists
run: |
# get version, author, name
VERSION=$(yq '.version' ${{ env.PLUGIN_PATH }}/manifest.yaml)
AUTHOR=$(yq '.author' ${{ env.PLUGIN_PATH }}/manifest.yaml)
NAME=$(yq '.name' ${{ env.PLUGIN_PATH }}/manifest.yaml)
echo "Checking plugin version: $VERSION"
# Check if the version already exists
RESPONSE_CODE=$(curl -s -o /dev/null -w "%{http_code}" "${{ secrets.MARKETPLACE_BASE_URL }}/api/v1/plugins/$AUTHOR/$NAME/$VERSION")
if [ "$RESPONSE_CODE" = "200" ]; then
RESPONSE=$(curl -s "${{ secrets.MARKETPLACE_BASE_URL }}/api/v1/plugins/$AUTHOR/$NAME/$VERSION")
if [ "$(echo "$RESPONSE" | jq -r '.code')" = "0" ]; then
echo "!!! Plugin version $VERSION already exists, please update the version number in manifest.yaml"
exit 1
fi
fi
- name: Check Plugin Deps
run: |
if [ -f ${{ env.PLUGIN_PATH }}/requirements.txt ]; then
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/upload-merged-plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ jobs:
- 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 }} -f
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 }}

0 comments on commit 8f5f2fd

Please sign in to comment.