task #5
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: task | |
on: | |
workflow_dispatch: | |
inputs: | |
PICA_DL_CONTENT: | |
description: '想下点什么?搜索/收藏夹/排行榜' | |
required: true | |
type: choice | |
default: search | |
options: | |
- search | |
- favorites | |
- leaderboard | |
PICA_DL_SEARCH_KEYWORDS: | |
description: '搜索关键字或者漫画ID (多个用 # 隔开)' | |
type: string | |
PICA_DL_CHAPTER: | |
description: '指定下载章节 (示例:all 或者 1,3,5-20)' | |
type: string | |
default: all | |
OUTPUT_ZIP: | |
description: '每个章节打成独立压缩包' | |
type: boolean | |
default: true | |
UPLOAD_FILEIO: | |
description: '上传到 file.io' | |
type: boolean | |
default: true | |
PICA_DL_CONCURRENCY: | |
description: '下载并发数' | |
required: true | |
type: number | |
default: 5 | |
DEBUG: | |
description: '调试模式' | |
type: boolean | |
default: false | |
env: | |
DEBUG: ${{ inputs.DEBUG && 'pica' }} | |
PICA_IN_GITHUB: true # 用于区分运行环境,不要修改 | |
PICA_ACCOUNT: ${{ secrets.PICA_ACCOUNT }} | |
PICA_PASSWORD: ${{ secrets.PICA_PASSWORD }} | |
PICA_DL_CONCURRENCY: ${{ inputs.PICA_DL_CONCURRENCY }} | |
PICA_DL_CONTENT: ${{ inputs.PICA_DL_CONTENT }} | |
PICA_DL_SEARCH_KEYWORDS: ${{ inputs.PICA_DL_SEARCH_KEYWORDS }} | |
PICA_DL_CHAPTER: ${{ inputs.PICA_DL_CHAPTER }} | |
jobs: | |
download: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v3 | |
with: | |
version: 8 | |
- name: Install node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'pnpm' | |
- name: Install deps and build | |
run: | | |
pnpm install | |
pnpm run build | |
- name: Download | |
run: pnpm start | |
- name: Compress | |
if: inputs.OUTPUT_ZIP | |
run: pnpm start:zip | |
- name: Upload to github | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pica-comics | |
path: ${{ inputs.OUTPUT_ZIP && 'comics-zip/' || 'comics/' }} | |
retention-days: 7 | |
- name: Upload to file.io | |
if: inputs.UPLOAD_FILEIO | |
run: node scripts/upload.js |