fix: 修复FFmpeg缓存问题

This commit is contained in:
lirtual 2024-12-21 23:22:34 +08:00
parent 06b77fb7ad
commit 0f9e351e34
1 changed files with 10 additions and 20 deletions

View File

@ -23,31 +23,21 @@ jobs:
id: cache-ffmpeg id: cache-ffmpeg
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
path: ~/.ffmpeg path: ~/ffmpeg
key: ${{ runner.os }}-ffmpeg-${{ hashFiles('.github/workflows/optimize-assets.yml') }} key: ${{ runner.os }}-ffmpeg-static-6.1
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 mkdir -p ~/ffmpeg
sudo apt-get install -y ffmpeg wget -q https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz
mkdir -p ~/.ffmpeg tar xf ffmpeg-release-amd64-static.tar.xz
cp $(which ffmpeg) ~/.ffmpeg/ mv ffmpeg-*-amd64-static/ffmpeg ~/ffmpeg/
mv ffmpeg-*-amd64-static/ffprobe ~/ffmpeg/
rm -rf ffmpeg-*-amd64-static*
- name: Setup FFmpeg from cache - name: Add FFmpeg to PATH
if: steps.cache-ffmpeg.outputs.cache-hit == 'true' run: echo "$HOME/ffmpeg" >> $GITHUB_PATH
run: |
mkdir -p ~/.ffmpeg
sudo cp ~/.ffmpeg/ffmpeg /usr/local/bin/
sudo chmod +x /usr/local/bin/ffmpeg
# 验证 FFmpeg 是否可用
ffmpeg -version || {
echo "Cached FFmpeg is not working, falling back to fresh install"
sudo apt-get update
sudo apt-get install -y ffmpeg
}
# 添加 node_modules 缓存 # 添加 node_modules 缓存
- name: Cache node_modules - name: Cache node_modules