-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathaction.yml
98 lines (88 loc) · 3.27 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: Setup yt-dlp
description: Setup/Install yt-dlp (a youtube-dl fork) for GitHub Actions
branding:
icon: play-circle
color: red
inputs:
ffmpeg:
description: Install yt-dlp/FFmpeg-Builds for yt-dlp
default: true
aria2:
description: Use aria2 by writing to yt-dlp config
default: true
version:
description: yt-dlp version
default: latest
nightly:
description: yt-dlp nightly
default: false
token:
description: GitHub token to avoid API rate limiting
default: ${{ github.token }}
runs:
using: composite
steps:
- name: Install yt-dlp/FFmpeg-Builds
if: runner.os != 'macOS' && inputs.ffmpeg != 'false'
uses: AnimMouse/setup-yt-dlp/ffmpeg@v3
with:
token: ${{ inputs.token }}
- name: Get yt-dlp version for Unix-like
id: version-unix-like
if: runner.os == 'Linux' || runner.os == 'macOS'
shell: bash
run: $GITHUB_ACTION_PATH/scripts/version/Unix-like.sh
env:
version: ${{ inputs.version }}
nightly: ${{ inputs.nightly }}
GITHUB_TOKEN: ${{ inputs.token }}
- name: Get yt-dlp version for Windows
id: version-windows
if: runner.os == 'Windows'
shell: pwsh
run: '& $env:GITHUB_ACTION_PATH\scripts\version\Windows.ps1'
env:
version: ${{ inputs.version }}
nightly: ${{ inputs.nightly }}
GITHUB_TOKEN: ${{ inputs.token }}
- name: Restore yt-dlp cache
id: cache
uses: actions/cache/restore@v4
with:
path: ${{ runner.tool_cache }}/yt-dlp
key: yt-dlp-${{ steps.version-unix-like.outputs.version || steps.version-windows.outputs.version }}-${{ runner.os }}
- name: Download yt-dlp for Unix-like
if: (runner.os == 'Linux' || runner.os == 'macOS') && ! steps.cache.outputs.cache-hit
shell: bash
working-directory: ${{ runner.temp }}
run: $GITHUB_ACTION_PATH/scripts/download/Unix-like.sh
env:
version: ${{ steps.version-unix-like.outputs.version }}
nightly: ${{ inputs.nightly }}
- name: Download yt-dlp for Windows
if: runner.os == 'Windows' && ! steps.cache.outputs.cache-hit
shell: pwsh
working-directory: ${{ runner.temp }}
run: '& $env:GITHUB_ACTION_PATH\scripts\download\Windows.ps1'
env:
version: ${{ steps.version-windows.outputs.version }}
nightly: ${{ inputs.nightly }}
- name: Install yt-dlp on tool cache
uses: AnimMouse/tool-cache@v1
with:
folder_name: yt-dlp
cache_hit: ${{ steps.cache.outputs.cache-hit }}
- name: Save yt-dlp cache
if: '! steps.cache.outputs.cache-hit'
uses: actions/cache/save@v4
with:
path: ${{ runner.tool_cache }}/yt-dlp
key: yt-dlp-${{ steps.version-unix-like.outputs.version || steps.version-windows.outputs.version }}-${{ runner.os }}
- name: Enable yt-dlp aria2 for Unix-like
if: (runner.os == 'Linux' || runner.os == 'macOS') && inputs.aria2 != 'false'
shell: bash
run: $GITHUB_ACTION_PATH/scripts/aria2/Unix-like.sh
- name: Enable yt-dlp aria2 for Windows
if: runner.os == 'Windows' && inputs.aria2 != 'false'
shell: pwsh
run: '& $env:GITHUB_ACTION_PATH\scripts\aria2\Windows.ps1'