Skip to content

Pack

Pack #4

Workflow file for this run

name: Pack
on: workflow_dispatch
jobs:
pack-to-zip:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
lfs: true
submodules: true
- name: Install dependencies
run: sudo apt -y install findutils zip unzip
- name: Delete unused files
run: |
cd "$GITHUB_WORKSPACE"
echo $(($(git log -1 --format=%ct) * 1000)) > .commit_time
cd ..
zip -9 -r -v "$RUNNER_TEMP/mpv-config".zip mpv-config
zip -d -v "$RUNNER_TEMP/mpv-config.zip" \*.git\* mpv-config/git-modules\*
unzip -d "$RUNNER_TEMP" "$RUNNER_TEMP/mpv-config.zip"
- name: Create clean script
run: |
cd "$RUNNER_TEMP/mpv-config"
cat > clean.ps1 <<'EOF'
using namespace System.IO
function DeleteEmptyDirs([string]$Path) {
$dirs = [Directory]::GetDirectories($Path)
foreach ($dir in $dirs) { DeleteEmptyDirs -Path $dir }
$dirs = [Directory]::GetDirectories($Path)
$files = [Directory]::GetFiles($Path)
if ($dirs.Length -eq 0 -and $files.Length -eq 0) { [Directory]::Delete($Path) }
}
DeleteEmptyDirs -Path $PSScriptRoot
EOF
echo 'CD %~dp0' > clean.bat
find . -type f ! -path ./clean.bat ! -path ./clean.ps1 | sed -e 's|^./|DEL |g' -e 's|/|\\|g' >> clean.bat
echo 'PowerShell -NoLogo -NoProfile -ExecutionPolicy RemoteSigned -File clean.ps1' >> clean.bat
echo 'DEL clean.ps1' >> clean.bat
echo 'DEL clean.bat' >> clean.bat
- name: Upload
uses: actions/upload-artifact@v3
with:
name: mpv-config
path: ${{ runner.temp }}/mpv-config