mirror of
https://codeberg.org/waydeer/layer-shika.git
synced 2025-12-14 16:55:55 +00:00
116 lines
3.1 KiB
YAML
116 lines
3.1 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*.*.*"
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
validate:
|
|
name: Validate Release
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- name: Install system dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y \
|
|
libwayland-dev \
|
|
libxkbcommon-dev \
|
|
libegl1-mesa-dev \
|
|
libgles2-mesa-dev \
|
|
libfontconfig1-dev
|
|
|
|
- name: Install Rust toolchain
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
components: clippy, rustfmt
|
|
|
|
- name: Cache cargo registry
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.cargo/registry
|
|
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- name: Cache cargo index
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.cargo/git
|
|
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- name: Check formatting
|
|
run: cargo fmt --all -- --check
|
|
|
|
- name: Run clippy
|
|
run: cargo clippy --workspace --all-targets -- -D warnings
|
|
|
|
- name: Run tests
|
|
run: cargo test --workspace --verbose
|
|
|
|
- name: Verify version matches tag
|
|
run: |
|
|
TAG_VERSION=${GITHUB_REF#refs/tags/v}
|
|
CARGO_VERSION=$(grep -m1 "^version = " Cargo.toml | cut -d'"' -f2)
|
|
if [ "$TAG_VERSION" != "$CARGO_VERSION" ]; then
|
|
echo "Tag version ($TAG_VERSION) doesn't match Cargo.toml version ($CARGO_VERSION)"
|
|
exit 1
|
|
fi
|
|
echo "Version check passed: $TAG_VERSION"
|
|
|
|
publish:
|
|
name: Publish to crates.io
|
|
needs: validate
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- name: Install system dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y \
|
|
libwayland-dev \
|
|
libxkbcommon-dev \
|
|
libegl1-mesa-dev \
|
|
libgles2-mesa-dev \
|
|
libfontconfig1-dev
|
|
|
|
- name: Install Rust toolchain
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: Publish crates to crates.io (in dependency order)
|
|
env:
|
|
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
|
run: |
|
|
cargo publish -p layer-shika-domain
|
|
sleep 10
|
|
cargo publish -p layer-shika-adapters
|
|
sleep 10
|
|
cargo publish -p layer-shika-composition
|
|
sleep 10
|
|
cargo publish -p layer-shika
|
|
|
|
create-release:
|
|
name: Create GitHub Release
|
|
needs: publish
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- name: Extract version
|
|
id: version
|
|
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Create Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: ${{ github.ref }}
|
|
name: Release v${{ steps.version.outputs.VERSION }}
|
|
draft: false
|
|
prerelease: false
|
|
generate_release_notes: true
|