Skip to content

Commit d98400d

Browse files
committed
v0.6.0
1 parent bfaeca4 commit d98400d

File tree

4 files changed

+210
-35
lines changed

4 files changed

+210
-35
lines changed

.github/workflows/build-cli.yml

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
name: Build CLI on Code Changes
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
paths:
7+
- "cli/**"
8+
- "core/**"
9+
- "wasm/**"
10+
- "Cargo.toml"
11+
- ".github/workflows/release-cli.yml"
12+
13+
jobs:
14+
build:
15+
name: Build - ${{ matrix.platform.os_name }} (${{ matrix.build_type.name }})
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
platform:
20+
- os_name: Linux-x86_64
21+
os: ubuntu-24.04
22+
target: x86_64-unknown-linux-gnu
23+
24+
- os_name: Linux-aarch64
25+
os: ubuntu-24.04
26+
target: aarch64-unknown-linux-gnu
27+
28+
- os_name: Linux-riscv64
29+
os: ubuntu-24.04
30+
target: riscv64gc-unknown-linux-gnu
31+
32+
- os_name: Windows-x86_64
33+
os: windows-latest
34+
target: x86_64-pc-windows-msvc
35+
36+
- os_name: Windows-aarch64
37+
os: windows-latest
38+
target: aarch64-pc-windows-msvc
39+
40+
- os_name: macOS-x86_64
41+
os: macos-13
42+
target: x86_64-apple-darwin
43+
44+
- os_name: macOS-aarch64
45+
os: macos-15
46+
target: aarch64-apple-darwin
47+
48+
build_type:
49+
- name: none
50+
features: "--no-default-features"
51+
suffix: ""
52+
- name: video
53+
features: "--no-default-features --features video"
54+
suffix: "-video"
55+
- name: gpu
56+
features: "--no-default-features --features gpu"
57+
suffix: "-gpu"
58+
- name: video-gpu
59+
features: "--no-default-features --features video,gpu"
60+
suffix: "-video-gpu"
61+
exclude:
62+
- platform:
63+
target: riscv64gc-unknown-linux-gnu
64+
build_type:
65+
name: video
66+
- platform:
67+
target: riscv64gc-unknown-linux-gnu
68+
build_type:
69+
name: video-gpu
70+
71+
runs-on: ${{ matrix.platform.os }}
72+
steps:
73+
- name: Checkout
74+
uses: actions/checkout@v4
75+
76+
- name: Install FFmpeg (Ubuntu)
77+
if: runner.os == 'Linux' && contains(matrix.build_type.name, 'video')
78+
run: |
79+
sudo apt-get update
80+
sudo apt-get install -y \
81+
libavutil-dev libavcodec-dev libavformat-dev \
82+
libavdevice-dev libswscale-dev libswresample-dev \
83+
libpostproc-dev
84+
85+
- name: Install FFmpeg (macOS)
86+
if: runner.os == 'macOS' && contains(matrix.build_type.name, 'video')
87+
run: |
88+
brew update
89+
brew install ffmpeg
90+
91+
- name: Set up MSBuild (Windows)
92+
if: runner.os == 'Windows' && contains(matrix.build_type.name, 'video')
93+
uses: microsoft/setup-msbuild@v2
94+
95+
- name: Download & extract FFmpeg (Windows)
96+
if: runner.os == 'Windows' && contains(matrix.build_type.name, 'video')
97+
shell: powershell
98+
run: |
99+
$target = "${{ matrix.platform.target }}"
100+
$ffmpegUrl = ""
101+
$ffmpegArchiveName = ""
102+
103+
if ($target -eq "x86_64-pc-windows-msvc") {
104+
$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'
105+
$ffmpegArchiveName = 'ffmpeg-x64.zip'
106+
Write-Host "Downloading x64 FFmpeg..."
107+
} elseif ($target -eq "aarch64-pc-windows-msvc") {
108+
$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'
109+
$ffmpegArchiveName = 'ffmpeg-arm64.zip'
110+
Write-Host "Downloading ARM64 FFmpeg..."
111+
} else {
112+
Write-Error "Unsupported Windows target: $target"
113+
exit 1
114+
}
115+
116+
$archive = Join-Path $Env:USERPROFILE $ffmpegArchiveName
117+
$dest = Join-Path $Env:USERPROFILE 'ffmpeg'
118+
119+
Invoke-WebRequest $ffmpegUrl -OutFile $archive -MaximumRedirection 5
120+
& (Join-Path $env:ProgramFiles '7-Zip\7z.exe') x $archive "-o$dest" -y
121+
Remove-Item $archive
122+
123+
$dirs = Get-ChildItem $dest | Where-Object PSIsContainer
124+
if ($dirs.Count -eq 1) {
125+
Get-ChildItem $dirs[0].FullName | Move-Item -Destination $dest -Force
126+
Remove-Item $dirs[0].FullName -Recurse -Force
127+
}
128+
129+
Add-Content -Path $Env:GITHUB_ENV -Value "FFMPEG_DIR=$dest"
130+
Add-Content -Path $Env:GITHUB_ENV -Value "INCLUDE=$dest\include;$Env:INCLUDE"
131+
Add-Content -Path $Env:GITHUB_ENV -Value "LIB=$dest\lib;$Env:LIB"
132+
Add-Content -Path $Env:GITHUB_ENV -Value "PATH=$dest\bin;$Env:PATH"
133+
134+
- name: Configure MSVC Environment via vcvarsall (Windows)
135+
if: |
136+
runner.os == 'Windows' &&
137+
contains(matrix.build_type.name, 'video') &&
138+
(matrix.platform.target == 'x86_64-pc-windows-msvc' ||
139+
matrix.platform.target == 'aarch64-pc-windows-msvc')
140+
shell: powershell
141+
run: |
142+
$target = "${{ matrix.platform.target }}"
143+
$vcvars_arch = ""
144+
145+
if ($target -eq "x86_64-pc-windows-msvc") {
146+
$vcvars_arch = "x64"
147+
Write-Host "Running vcvarsall.bat x64 for x86_64 target..."
148+
} elseif ($target -eq "aarch64-pc-windows-msvc") {
149+
$vcvars_arch = "x64_arm64"
150+
Write-Host "Running vcvarsall.bat x64_arm64 for aarch64 target..."
151+
} else {
152+
Write-Error "Unsupported Windows target for vcvarsall.bat: $target"
153+
exit 1
154+
}
155+
156+
$scriptContent = @"
157+
@echo off
158+
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" $vcvars_arch >nul
159+
set
160+
"@
161+
162+
$tempScriptPath = Join-Path $env:TEMP "run_vcvars.bat"
163+
$scriptContent | Out-File $tempScriptPath -Encoding UTF8
164+
165+
$vcvarsOutput = cmd.exe /c $tempScriptPath
166+
167+
foreach ($line in $vcvarsOutput) {
168+
if ($line -match "^(.+?)=(.*)$") {
169+
$varName = $matches[1]
170+
$varValue = $matches[2]
171+
Add-Content -Path $Env:GITHUB_ENV -Value "$varName=$varValue"
172+
}
173+
}
174+
Remove-Item $tempScriptPath
175+
176+
- name: Build palettum-cli
177+
uses: houseabsolute/actions-rust-cross@v1
178+
with:
179+
command: build
180+
target: ${{ matrix.platform.target }}
181+
args: "--release -p cli ${{ matrix.build_type.features }}"
182+
strip: true
183+
184+
- name: Upload CLI artifacts
185+
uses: actions/upload-artifact@v4
186+
with:
187+
name: palettum-${{ matrix.platform.target }}${{ matrix.build_type.suffix }}
188+
path: |
189+
target/${{ matrix.platform.target }}/release/palettum*

.github/workflows/release-cli.yml

Lines changed: 17 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
1-
name: Build and Release CLI
1+
name: Release CLI on Tag Push
22

33
on:
4-
workflow_dispatch:
54
push:
6-
paths:
7-
- "cli/**"
8-
- "core/**"
9-
- "wasm/**"
10-
- "Cargo.toml"
11-
- ".github/workflows/release-cli.yml"
125
tags:
136
- "v*"
147

158
jobs:
16-
build:
17-
name: Build - ${{ matrix.platform.os_name }} (${{ matrix.build_type.name }})
9+
build-and-release:
10+
name: Build & Release - ${{ matrix.platform.os_name }} (${{ matrix.build_type.name }})
1811
strategy:
1912
fail-fast: false
2013
matrix:
@@ -60,6 +53,7 @@ jobs:
6053
- name: video-gpu
6154
features: "--no-default-features --features video,gpu"
6255
suffix: "-video-gpu"
56+
6357
exclude:
6458
- platform:
6559
target: riscv64gc-unknown-linux-gnu
@@ -71,6 +65,7 @@ jobs:
7165
name: video-gpu
7266

7367
runs-on: ${{ matrix.platform.os }}
68+
7469
steps:
7570
- name: Checkout
7671
uses: actions/checkout@v4
@@ -105,32 +100,30 @@ jobs:
105100
if ($target -eq "x86_64-pc-windows-msvc") {
106101
$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'
107102
$ffmpegArchiveName = 'ffmpeg-x64.zip'
108-
Write-Host "Downloading x64 FFmpeg from BtbN..."
103+
Write-Host "Downloading x64 FFmpeg..."
109104
} elseif ($target -eq "aarch64-pc-windows-msvc") {
110105
$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'
111106
$ffmpegArchiveName = 'ffmpeg-arm64.zip'
112-
Write-Host "Downloading AARCH64 FFmpeg from BtbN..."
107+
Write-Host "Downloading ARM64 FFmpeg..."
113108
} else {
114-
Write-Error "Unsupported Windows target for FFmpeg download: $target"
109+
Write-Error "Unsupported Windows target: $target"
115110
exit 1
116111
}
117112
118113
$archive = Join-Path $Env:USERPROFILE $ffmpegArchiveName
119114
$dest = Join-Path $Env:USERPROFILE 'ffmpeg'
120115
121116
Invoke-WebRequest $ffmpegUrl -OutFile $archive -MaximumRedirection 5
122-
Write-Host "Extracting FFmpeg to $dest"
123-
$seven = Join-Path $env:ProgramFiles '7-Zip\7z.exe'
124-
& $seven x $archive "-o$dest" -y
117+
& (Join-Path $env:ProgramFiles '7-Zip\7z.exe') x $archive "-o$dest" -y
125118
Remove-Item $archive
126119
127120
$nestedDirs = Get-ChildItem -Path $dest | Where-Object { $_.PSIsContainer }
128121
if ($nestedDirs.Count -eq 1) {
129-
Write-Host "Found nested directory: $($nestedDirs[0].FullName). Moving contents up."
130-
Get-ChildItem -Path $nestedDirs[0].FullName | Move-Item -Destination $dest -Force
131-
Remove-Item -Path $nestedDirs[0].FullName -Recurse -Force
122+
Write-Host "Found nested directory: $($nestedDirs[0].FullName). Moving contents up."
123+
Get-ChildItem -Path $nestedDirs[0].FullName | Move-Item -Destination $dest -Force
124+
Remove-Item -Path $nestedDirs[0].FullName -Recurse -Force
132125
} else {
133-
Write-Host "No single nested directory found or contents already at top level."
126+
Write-Host "No single nested directory found or contents already at top level."
134127
}
135128
136129
Add-Content -Path $Env:GITHUB_ENV -Value "FFMPEG_DIR=$dest"
@@ -142,7 +135,8 @@ jobs:
142135
if: |
143136
runner.os == 'Windows' &&
144137
contains(matrix.build_type.name, 'video') &&
145-
(matrix.platform.target == 'x86_64-pc-windows-msvc' || matrix.platform.target == 'aarch64-pc-windows-msvc')
138+
(matrix.platform.target == 'x86_64-pc-windows-msvc' ||
139+
matrix.platform.target == 'aarch64-pc-windows-msvc')
146140
shell: powershell
147141
run: |
148142
$target = "${{ matrix.platform.target }}"
@@ -187,18 +181,10 @@ jobs:
187181
args: "--release -p cli ${{ matrix.build_type.features }}"
188182
strip: true
189183

190-
- name: Publish artifact as Draft Release
191-
if: "!startsWith(github.ref, 'refs/tags/v')"
192-
uses: houseabsolute/actions-rust-release@v0
193-
with:
194-
executable-name: palettum${{ matrix.build_type.suffix }}
195-
target: ${{ matrix.platform.target }}
196-
changes-file: ""
197-
198184
- name: Publish GitHub Release
199-
if: startsWith(github.ref, 'refs/tags/v')
200185
uses: houseabsolute/actions-rust-release@v0
201186
with:
202-
executable-name: palettum${{ matrix.build_type.suffix }}
187+
executable-name: palettum
188+
archive-name: palettum-${{ matrix.platform.target }}${{ matrix.build_type.suffix }}
203189
target: ${{ matrix.platform.target }}
204190
changes-file: ""

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ tabled = "0.19.0"
2424
[workspace.package]
2525
edition = "2021"
2626
license = "AGPL-3.0"
27-
version = "0.5.2"
27+
version = "0.6.0"
2828
description = "Tool for recoloring images and GIFs with any palette of your choice"
2929

3030
[profile.release]

0 commit comments

Comments
 (0)