name: NoneBot preview on: push: branches: [main] pull_request: workflow_dispatch: inputs: publish: description: Sync NoneBot repository and trigger PyPI version release default: false type: boolean permissions: contents: read concurrency: group: farm-preview-${{ github.workflow }}-${{ github.ref }} cancel-in-progress: false jobs: test: runs-on: ubuntu-latest strategy: matrix: python: ['3.10', '3.12'] env: PYTHONPATH: src PYTHONIOENCODING: utf-8 steps: - uses: actions/checkout@v7 with: persist-credentials: false - uses: actions/setup-python@v7 with: python-version: ${{ matrix.python }} - run: >- python -m pip install "Pillow>=10.4,<13" setuptools wheel "PyYAML>=6,<7" build -r integrations/astrbot/requirements.txt -r requirements-build.txt - run: python scripts/ci_font.py - run: python scripts/check_workflows.py - run: python scripts/verify_foundation.py build: needs: test runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 with: persist-credentials: false - uses: actions/setup-python@v7 with: python-version: '3.10' - name: Verify external asset manifest run: python scripts/check_asset_manifest.py - name: Install help rendering dependencies run: | python -m pip install "Pillow>=10.4,<13" -r requirements-build.txt sudo apt-get update sudo apt-get install -y fonts-noto-cjk - run: python scripts/ci_font.py - name: Generate NoneBot help menu run: >- python scripts/preview_help.py --platform nonebot --output runtime/help-images/images - run: >- python scripts/build_nonebot.py --output dist/nonebot-preview --help-image runtime/help-images/images/help-nonebot.png - run: >- python scripts/verify_nonebot.py --directory dist/nonebot-preview/repository - run: python -m pip install build - name: Build wheel and sdist working-directory: dist/nonebot-preview/repository run: python -m build --sdist --wheel --outdir ../packages - name: Verify installed NoneBot entry run: | python -m pip install dist/nonebot-preview/packages/*.whl python -m pip install nonebot-adapter-onebot python scripts/check_nonebot_runtime.py - uses: actions/upload-artifact@v7 with: name: nonebot-preview path: dist/nonebot-preview/ include-hidden-files: true if-no-files-found: error retention-days: 14 sync-preview: if: >- (github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.publish)) && github.ref == 'refs/heads/main' && github.repository == 'Shu-Ying/main_plugin_farm' needs: [test, build] runs-on: ubuntu-latest # 沿用真寻环境,使 environment 中的 FARM_RELEASE_TOKEN 同样可用。 environment: zhenxun-preview steps: - uses: actions/checkout@v7 with: persist-credentials: false - uses: actions/setup-python@v7 with: python-version: '3.12' - uses: actions/download-artifact@v8 with: name: nonebot-preview path: incoming - name: Sync NoneBot repository and trigger version release env: FARM_RELEASE_TOKEN: ${{ secrets.FARM_RELEASE_TOKEN }} run: >- python scripts/publish_nonebot.py incoming/nonebot_plugin_farm-*.zip --publish --release-tag