fix: 修复FFmpeg缓存问题

This commit is contained in:
lirtual 2024-12-21 22:32:35 +08:00
parent be4209ab14
commit 5ba5a02c76
1 changed files with 14 additions and 3 deletions

View File

@ -18,19 +18,30 @@ jobs:
node-version: '18' node-version: '18'
cache: 'npm' cache: 'npm'
# 添加 FFmpeg 缓存 # 优化 FFmpeg 缓存
- name: Cache FFmpeg - name: Cache FFmpeg
id: cache-ffmpeg id: cache-ffmpeg
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
path: /usr/bin/ffmpeg path: ~/.ffmpeg
key: ${{ runner.os }}-ffmpeg key: ${{ runner.os }}-ffmpeg-${{ hashFiles('.github/workflows/optimize-assets.yml') }}
restore-keys: |
${{ runner.os }}-ffmpeg-
- name: Install FFmpeg - name: Install FFmpeg
if: steps.cache-ffmpeg.outputs.cache-hit != 'true' if: steps.cache-ffmpeg.outputs.cache-hit != 'true'
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install -y ffmpeg sudo apt-get install -y ffmpeg
mkdir -p ~/.ffmpeg
which ffmpeg > ~/.ffmpeg/path
cp $(which ffmpeg) ~/.ffmpeg/
- name: Setup FFmpeg from cache
if: steps.cache-ffmpeg.outputs.cache-hit == 'true'
run: |
sudo cp ~/.ffmpeg/ffmpeg /usr/local/bin/
sudo chmod +x /usr/local/bin/ffmpeg
# 添加 node_modules 缓存 # 添加 node_modules 缓存
- name: Cache node_modules - name: Cache node_modules