Files
dify-plugin-repackaging/.github/workflows/build.yml
yodhcn bf1f8da969 Add ARM platform support to build workflow (#50)
* Add ARM platform support to build workflow

* docs: update README with GitHub Actions usage steps

* docs: update README with GitHub Actions usage steps
2026-01-07 15:00:36 +08:00

82 lines
2.5 KiB
YAML

name: Repackage Dify Plugin
on:
workflow_dispatch:
inputs:
plugin_author:
description: "plugin author"
required: true
type: string
plugin_name:
description: "plugin name"
required: true
type: string
plugin_version:
description: "plugin version"
required: true
type: string
platform_arm:
description: "Use ARM platform (true = manylinux_2_17_aarch64, false = manylinux_2_17_x86_64)"
required: true
default: "false"
jobs:
repackage:
runs-on: ubuntu-latest
steps:
- name: Print workflow inputs
run: |
echo "plugin_author = ${{ inputs.plugin_author }}"
echo "plugin_name = ${{ inputs.plugin_name }}"
echo "plugin_version = ${{ inputs.plugin_version }}"
echo "platform_arm = ${{ inputs.platform_arm }}"
- name: Resolve platform
run: |
if [ "${{ inputs.platform_arm }}" = "true" ]; then
echo "PIP_PLATFORM=manylinux_2_17_aarch64" >> "$GITHUB_ENV"
echo "PACKAGE_SUFFIX=offline-arm" >> "$GITHUB_ENV"
else
echo "PIP_PLATFORM=manylinux_2_17_x86_64" >> "$GITHUB_ENV"
echo "PACKAGE_SUFFIX=offline" >> "$GITHUB_ENV"
fi
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Make plugin_repackaging.sh executable
run: chmod +x ./plugin_repackaging.sh
- name: Run plugin repackaging script
run: |
PIP_MIRROR_URL=https://pypi.org/simple \
./plugin_repackaging.sh \
-p ${{ env.PIP_PLATFORM }} \
-s ${{ env.PACKAGE_SUFFIX }} \
market \
"${{ github.event.inputs.plugin_author }}" \
"${{ github.event.inputs.plugin_name }}" \
"${{ github.event.inputs.plugin_version }}"
- name: Find repackaged artifact
run: |
ARTIFACT_PATH=$(find . -type f -name "*-${PACKAGE_SUFFIX}.difypkg" | head -n 1)
if [ -z "$ARTIFACT_PATH" ]; then
echo "No *-${PACKAGE_SUFFIX}.difypkg artifact found!"
exit 1
fi
echo "ARTIFACT_PATH=$ARTIFACT_PATH" >> $GITHUB_ENV
echo "ARTIFACT_NAME=$(basename "$ARTIFACT_PATH")" >> $GITHUB_ENV
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.ARTIFACT_PATH }}