feat: continuous scroll #138
This file contains hidden or 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
| # GitHub workflow for generating test files and deploying to gh-pages | |
| name: Generate Test Files and Deploy to gh-pages | |
| # Controls when the action will run. | |
| on: | |
| # Triggers the workflow on push to main branch | |
| push: | |
| branches: [ main ] | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| # A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
| jobs: | |
| # This workflow contains a single job called "build-and-deploy" | |
| build-and-deploy: | |
| # The type of runner that the job will run on | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| # Steps represent a sequence of tasks that will be executed as part of the job | |
| steps: | |
| # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
| - uses: actions/checkout@v2 | |
| # Sets up python | |
| - uses: actions/setup-python@v2 | |
| with: | |
| python-version: 3.14 | |
| # Install dependencies | |
| - name: "Installs dependencies" | |
| run: | | |
| python3 -m pip install --upgrade pip | |
| python3 -m pip install setuptools wheel twine | |
| # Build and install the project | |
| - name: "Builds and installs the project" | |
| run: | | |
| python3 setup.py sdist bdist_wheel | |
| python3 -m pip install -e . --break-system-packages | |
| # Generate test files | |
| - name: "Generates test files" | |
| run: | | |
| # Check if there are any EPUB files in examples directory | |
| if [ -z "$(ls -A examples/*.epub 2>/dev/null)" ]; then | |
| echo "No EPUB files found in examples directory" | |
| exit 1 | |
| fi | |
| # Generate test files | |
| epub-browser ./examples --no-server --output-dir ./test --keep-files | |
| # Deploy to gh-pages | |
| - name: "Deploys to gh-pages" | |
| uses: peaceiris/actions-gh-pages@v3 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./test | |
| publish_branch: gh-pages | |
| force_orphan: true | |
| commit_message: "Update test files" | |
| # Send Feishu notification | |
| - name: "Send Feishu notification" | |
| if: always() | |
| run: | | |
| STATUS="${{ job.status }}" | |
| if [ "$STATUS" == "success" ]; then | |
| STATUS_TEXT="成功" | |
| elif [ "$STATUS" == "failure" ]; then | |
| STATUS_TEXT="失败" | |
| else | |
| STATUS_TEXT="取消" | |
| fi | |
| curl -X POST "${{ secrets.FEISHU_WEBHOOK }}" \ | |
| -H "Content-Type: application/json" \ | |
| -d "{ | |
| \"msg_type\": \"text\", | |
| \"content\": { | |
| \"text\": \"GitHub workflow 通知:\\n- 工作流:Generate Test Files and Deploy to gh-pages\\n- 状态:$STATUS_TEXT\\n- 触发事件:${{ github.event_name }}\\n- 提交:${{ github.sha }}\\n- 分支:${{ github.ref }}\\n- 仓库:${{ github.repository }}\" | |
| } | |
| }" | |
| # Wait for Cloudflare Pages deployment and send notification | |
| - name: Wait for Cloudflare Pages deployment | |
| uses: dfface/cloudflare-pages-notification@v1 | |
| with: | |
| apiToken: ${{ secrets.CF_API_TOKEN }} | |
| accountId: ${{ secrets.CF_ACCOUNT_ID }} | |
| project: ${{ secrets.CF_PAGES_PROJECT }} | |
| notificationType: feishu | |
| webhookUrl: ${{ secrets.FEISHU_WEBHOOK }} |