-
Notifications
You must be signed in to change notification settings - Fork 5
190 lines (161 loc) · 6.73 KB
/
release-cli.yml
File metadata and controls
190 lines (161 loc) · 6.73 KB
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
name: Release CLI on Tag Push
on:
push:
tags:
- "v*"
jobs:
build-and-release:
name: Build & Release - ${{ matrix.platform.os_name }} (${{ matrix.build_type.name }})
strategy:
fail-fast: false
matrix:
platform:
- os_name: Linux-x86_64
os: ubuntu-24.04
target: x86_64-unknown-linux-gnu
- os_name: Linux-aarch64
os: ubuntu-24.04
target: aarch64-unknown-linux-gnu
- os_name: Linux-riscv64
os: ubuntu-24.04
target: riscv64gc-unknown-linux-gnu
- os_name: Windows-x86_64
os: windows-latest
target: x86_64-pc-windows-msvc
- os_name: Windows-aarch64
os: windows-latest
target: aarch64-pc-windows-msvc
- os_name: macOS-x86_64
os: macos-13
target: x86_64-apple-darwin
- os_name: macOS-aarch64
os: macos-15
target: aarch64-apple-darwin
build_type:
- name: none
features: "--no-default-features"
suffix: ""
- name: video
features: "--no-default-features --features video"
suffix: "-video"
- name: gpu
features: "--no-default-features --features gpu"
suffix: "-gpu"
- name: video-gpu
features: "--no-default-features --features video,gpu"
suffix: "-video-gpu"
exclude:
- platform:
target: riscv64gc-unknown-linux-gnu
build_type:
name: video
- platform:
target: riscv64gc-unknown-linux-gnu
build_type:
name: video-gpu
runs-on: ${{ matrix.platform.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install FFmpeg (Ubuntu)
if: runner.os == 'Linux' && contains(matrix.build_type.name, 'video')
run: |
sudo apt-get update
sudo apt-get install -y \
libavutil-dev libavcodec-dev libavformat-dev \
libavdevice-dev libswscale-dev libswresample-dev \
libpostproc-dev
- name: Install FFmpeg (macOS)
if: runner.os == 'macOS' && contains(matrix.build_type.name, 'video')
run: |
brew update
brew install ffmpeg
- name: Set up MSBuild (Windows)
if: runner.os == 'Windows' && contains(matrix.build_type.name, 'video')
uses: microsoft/setup-msbuild@v2
- name: Download & extract FFmpeg (Windows)
if: runner.os == 'Windows' && contains(matrix.build_type.name, 'video')
shell: powershell
run: |
$target = "${{ matrix.platform.target }}"
$ffmpegUrl = ""
$ffmpegArchiveName = ""
if ($target -eq "x86_64-pc-windows-msvc") {
$ffmpegUrl = 'https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-2025-07-20-14-02/ffmpeg-n7.1.1-56-gc2184b65d2-win64-gpl-shared-7.1.zip'
$ffmpegArchiveName = 'ffmpeg-x64.zip'
Write-Host "Downloading x64 FFmpeg..."
} elseif ($target -eq "aarch64-pc-windows-msvc") {
$ffmpegUrl = 'https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-2025-07-20-14-02/ffmpeg-n7.1.1-56-gc2184b65d2-winarm64-gpl-shared-7.1.zip'
$ffmpegArchiveName = 'ffmpeg-arm64.zip'
Write-Host "Downloading ARM64 FFmpeg..."
} else {
Write-Error "Unsupported Windows target: $target"
exit 1
}
$archive = Join-Path $Env:USERPROFILE $ffmpegArchiveName
$dest = Join-Path $Env:USERPROFILE 'ffmpeg'
Invoke-WebRequest $ffmpegUrl -OutFile $archive -MaximumRedirection 5
& (Join-Path $env:ProgramFiles '7-Zip\7z.exe') x $archive "-o$dest" -y
Remove-Item $archive
$nestedDirs = Get-ChildItem -Path $dest | Where-Object { $_.PSIsContainer }
if ($nestedDirs.Count -eq 1) {
Write-Host "Found nested directory: $($nestedDirs[0].FullName). Moving contents up."
Get-ChildItem -Path $nestedDirs[0].FullName | Move-Item -Destination $dest -Force
Remove-Item -Path $nestedDirs[0].FullName -Recurse -Force
} else {
Write-Host "No single nested directory found or contents already at top level."
}
Add-Content -Path $Env:GITHUB_ENV -Value "FFMPEG_DIR=$dest"
Add-Content -Path $Env:GITHUB_ENV -Value "INCLUDE=$dest\include;$Env:INCLUDE"
Add-Content -Path $Env:GITHUB_ENV -Value "LIB=$dest\lib;$Env:LIB"
Add-Content -Path $Env:GITHUB_ENV -Value "PATH=$dest\bin;$Env:PATH"
- name: Configure MSVC Environment via vcvarsall (Windows)
if: |
runner.os == 'Windows' &&
contains(matrix.build_type.name, 'video') &&
(matrix.platform.target == 'x86_64-pc-windows-msvc' ||
matrix.platform.target == 'aarch64-pc-windows-msvc')
shell: powershell
run: |
$target = "${{ matrix.platform.target }}"
$vcvars_arch = ""
if ($target -eq "x86_64-pc-windows-msvc") {
$vcvars_arch = "x64"
Write-Host "Running vcvarsall.bat x64 for x86_64 target..."
} elseif ($target -eq "aarch64-pc-windows-msvc") {
$vcvars_arch = "x64_arm64"
Write-Host "Running vcvarsall.bat x64_arm64 for aarch64 target..."
} else {
Write-Error "Unsupported Windows target for vcvarsall.bat: $target"
exit 1
}
$scriptContent = @"
@echo off
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" $vcvars_arch >nul
set
"@
$tempScriptPath = Join-Path $env:TEMP "run_vcvars.bat"
$scriptContent | Out-File $tempScriptPath -Encoding UTF8
$vcvarsOutput = cmd.exe /c $tempScriptPath
foreach ($line in $vcvarsOutput) {
if ($line -match "^(.+?)=(.*)$") {
$varName = $matches[1]
$varValue = $matches[2]
Add-Content -Path $Env:GITHUB_ENV -Value "$varName=$varValue"
}
}
Remove-Item $tempScriptPath
- name: Build palettum-cli
uses: houseabsolute/actions-rust-cross@v1
with:
command: build
target: ${{ matrix.platform.target }}
args: "--release -p cli ${{ matrix.build_type.features }}"
strip: true
- name: Publish GitHub Release
uses: houseabsolute/actions-rust-release@v0
with:
executable-name: palettum
archive-name: palettum-${{ matrix.platform.target }}${{ matrix.build_type.suffix }}
target: ${{ matrix.platform.target }}
changes-file: ""