Skip to content

chore(release): bump version to 0.1.3-test #77

chore(release): bump version to 0.1.3-test

chore(release): bump version to 0.1.3-test #77

Workflow file for this run

# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: 2025 elnPack Contributors
name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
# Simplified manual tag release flow using git-cliff for notes.
# Changelog is generated at publish time from git history.
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
jobs:
checks:
name: Lint & Test (Linux)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-stable-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Install toolchain
uses: dtolnay/rust-toolchain@0b1efabc08b657293548b77fb76cc02d26091c7e
with:
toolchain: stable
components: rustfmt, clippy
- name: Cargo fmt
run: cargo fmt --all -- --check
- name: Cargo clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Cargo test
run: cargo test --all
build:
name: Build ${{ matrix.target }}
needs: checks
strategy:
fail-fast: false
matrix:
include:
- runner: ubuntu-latest
target: x86_64-unknown-linux-gnu
archive: tar.gz
rustflags: ""
linux: true
pkg_config_libdir: ""
multilib: false
toolchain: stable
build_std_flag: ""
install_target: true
- runner: ubuntu-latest
target: i686-unknown-linux-gnu
archive: tar.gz
rustflags: ""
linux: true
pkg_config_libdir: "/usr/lib/i386-linux-gnu/pkgconfig"
multilib: true
toolchain: stable
build_std_flag: ""
install_target: true
- runner: macos-latest
target: x86_64-apple-darwin
archive: tar.gz
rustflags: ""
linux: false
pkg_config_libdir: ""
multilib: false
toolchain: stable
build_std_flag: ""
install_target: true
- runner: macos-latest
target: aarch64-apple-darwin
archive: tar.gz
rustflags: ""
linux: false
pkg_config_libdir: ""
multilib: false
toolchain: stable
build_std_flag: ""
install_target: true
- runner: windows-latest
target: x86_64-pc-windows-msvc
archive: zip
rustflags: ""
linux: false
pkg_config_libdir: ""
multilib: false
toolchain: stable
build_std_flag: ""
install_target: true
- runner: windows-latest
target: i686-pc-windows-msvc
archive: zip
rustflags: ""
linux: false
pkg_config_libdir: ""
multilib: false
toolchain: stable
build_std_flag: ""
install_target: true
runs-on: ${{ matrix.runner }}
env:
TARGET: ${{ matrix.target }}
RUSTFLAGS: ${{ matrix.rustflags }}
PKG_CONFIG_LIBDIR: ${{ matrix.pkg_config_libdir }}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set safe ref name (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$safe = $env:GITHUB_REF_NAME -replace '/', '-'
Add-Content -Path $env:GITHUB_ENV -Value "SAFE_REF=$safe"
- name: Set safe ref name (Unix)
if: runner.os != 'Windows'
shell: bash
run: echo "SAFE_REF=${GITHUB_REF_NAME//\//-}" >> "$GITHUB_ENV"
- name: Install toolchain
uses: dtolnay/rust-toolchain@0b1efabc08b657293548b77fb76cc02d26091c7e
with:
toolchain: ${{ matrix.toolchain }}
- name: Add target
if: matrix.install_target
run: rustup target add ${{ matrix.target }} --toolchain ${{ matrix.toolchain }}
- name: Add rust-src component
if: matrix.build_std_flag != ''
run: rustup component add rust-src --toolchain ${{ matrix.toolchain }}
- name: Install Linux build deps
if: matrix.linux
run: |
sudo apt-get update
sudo apt-get install -y \
pkg-config \
libx11-dev libxcursor-dev libxrandr-dev libxi-dev \
libgl1-mesa-dev libasound2-dev libudev-dev \
libwayland-dev libxkbcommon-dev
- name: Install 32-bit Linux deps
if: matrix.target == 'i686-unknown-linux-gnu'
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y \
gcc-multilib g++-multilib pkg-config \
libx11-dev:i386 libxcursor-dev:i386 libxrandr-dev:i386 libxi-dev:i386 \
libgl1-mesa-dev:i386 libasound2-dev:i386 libudev-dev:i386 \
libwayland-dev:i386 libxkbcommon-dev:i386
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ matrix.toolchain }}-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Build release
run: cargo +${{ matrix.toolchain }} build ${{ matrix.build_std_flag }} --release --target ${{ matrix.target }}
- name: Package artifact (Linux)
if: matrix.archive == 'tar.gz'
run: |
bin_path=target/$TARGET/release/elnpack
pkg_dir=package-${{ runner.os }}
mkdir -p "$pkg_dir"
cp "$bin_path" "$pkg_dir/"
cp README.md LICENSE "$pkg_dir/"
tar -czf "elnpack-$SAFE_REF-$TARGET.tar.gz" -C "$pkg_dir" .
- name: Package artifact (Windows)
if: matrix.archive == 'zip'
shell: pwsh
run: |
$binPath = "target/${env:TARGET}/release/elnpack.exe"
$pkgDir = "package-${env:RUNNER_OS}"
New-Item -ItemType Directory -Force -Path $pkgDir | Out-Null
Copy-Item $binPath "$pkgDir/"
Copy-Item "README.md","LICENSE" "$pkgDir/"
$safeRef = $env:SAFE_REF
Compress-Archive -Path "$pkgDir/*" -DestinationPath "elnpack-$safeRef-${env:TARGET}.zip"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: elnpack-${{ env.SAFE_REF }}-${{ matrix.target }}
path: |
elnpack-${{ env.SAFE_REF }}-${{ matrix.target }}.${{ matrix.archive }}
publish:
name: Publish Release
if: startsWith(github.ref, 'refs/tags/v')
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout (full history for git-cliff)
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: dist
- name: List artifacts
run: ls -R dist
- name: Generate checksums
run: |
cd dist
: > SHA256SUMS
find . -maxdepth 2 -type f \( -name "*.tar.gz" -o -name "*.zip" \) -print0 \
| sort -z \
| xargs -0 -r sha256sum >> SHA256SUMS
- name: Generate changelog with git-cliff
uses: orhun/git-cliff-action@v2
with:
config: cliff.toml
args: --tag ${{ github.ref_name }} --output release_notes.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
files: |
dist/**/*
draft: false
generate_release_notes: false
body_path: release_notes.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}