name: "publish"
on:
push:
tags: ["v[0-9]+.[0-9]+.[0-9]+*"]
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
CARGO_TERM_COLOR: always
jobs:
macos:
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
target: aarch64-apple-darwin
artifact: imageoptimize-darwin-aarch64.tar.gz
- os: macos-15-intel
target: x86_64-apple-darwin
artifact: imageoptimize-darwin-x86_64.tar.gz
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.95.0
targets: ${{ matrix.target }}
- name: Install dependencies
run: brew install yasm
- name: release
run: |
cargo build --features=bin --release --target=${{ matrix.target }}
mv target/${{ matrix.target }}/release/imageoptimize ./imageoptimize
tar -czvf ${{ matrix.artifact }} imageoptimize
ls -lh imageoptimize
- name: Upload Assets
run: |
ls -lh ${{ matrix.artifact }}
./.github/workflows/upload_asset.sh ./${{ matrix.artifact }} $GITHUB_TOKEN
linux-musl:
strategy:
matrix:
include:
- runs-on: ubuntu-22.04
target: x86_64-unknown-linux-musl
artifact: imageoptimize-linux-musl-x86_64.tar.gz
- runs-on: ubuntu-22.04-arm
target: aarch64-unknown-linux-musl
artifact: imageoptimize-linux-musl-aarch64.tar.gz
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.95.0
targets: ${{ matrix.target }}
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y nasm musl-tools
pip3 install ziglang
cargo install cargo-zigbuild --locked
- name: release
run: |
cargo zigbuild --features=bin --release --target=${{ matrix.target }}
mv target/${{ matrix.target }}/release/imageoptimize ./imageoptimize
tar -czvf ${{ matrix.artifact }} imageoptimize
ls -lh imageoptimize
- name: Upload Assets
run: |
ls -lh ${{ matrix.artifact }}
./.github/workflows/upload_asset.sh ./${{ matrix.artifact }} $GITHUB_TOKEN
windows:
runs-on: windows-latest
name: ${{ matrix.target }}
env:
CFG_RELEASE_CHANNEL: ${{ matrix.cfg_release_channel }}
strategy:
matrix:
target: [x86_64-pc-windows-msvc]
steps:
- name: disable git eol translation
run: git config --global core.autocrlf false
- uses: actions/checkout@v4
- name: Install Rustup using win.rustup.rs
run: |
# Disable the download progress bar which can cause perf issues
$ProgressPreference = "SilentlyContinue"
Invoke-WebRequest https://win.rustup.rs/ -OutFile rustup-init.exe
.\rustup-init.exe -y --default-host=x86_64-pc-windows-msvc --default-toolchain=none
del rustup-init.exe
rustup target add ${{ matrix.target }}
shell: powershell
- name: Add mingw64 to path for x86_64-gnu
run: echo "C:\msys64\mingw64\bin" >> $GITHUB_PATH
if: matrix.target == 'x86_64-pc-windows-gnu' && matrix.channel == 'nightly'
shell: bash
- name: Set Perl environment variables
if: runner.os == 'Windows'
run: |
echo "PERL=$((where.exe perl)[0])" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
echo "OPENSSL_SRC_PERL=$((where.exe perl)[0])" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
- name: Run cargo release
shell: bash
run: |
cargo --version
cargo build --features=bin --release
mv target/release/imageoptimize.exe ./imageoptimize.exe
- name: Zip
shell: powershell
run: |
Compress-Archive -Path imageoptimize.exe -Destination imageoptimize-windows.exe.zip
- name: Upload Assets
shell: bash
run: |
ls -lh imageoptimize-windows.exe.zip
./.github/workflows/upload_asset.sh ./imageoptimize-windows.exe.zip $GITHUB_TOKEN