forked from mirrors/kingfisher
261 lines
No EOL
7.4 KiB
YAML
261 lines
No EOL
7.4 KiB
YAML
name: build-and-release
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
# ──────────────── Linux (via Makefile) ────────────────
|
|
linux-x64:
|
|
name: Linux x64
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: 1.88.0
|
|
profile: minimal
|
|
override: true
|
|
|
|
- uses: swatinem/rust-cache@v2
|
|
|
|
- name: Install packaging tools
|
|
run: cargo install cargo-deb cargo-generate-rpm
|
|
|
|
- name: Build (Makefile linux-x64)
|
|
run: make linux-x64
|
|
|
|
- name: Fix permissions
|
|
run: sudo chown -R $(id -u):$(id -g) target
|
|
|
|
- name: Build Debian package
|
|
run: |
|
|
cargo deb --no-build --target x86_64-unknown-linux-musl \
|
|
--output target/release/kingfisher-linux-x64.deb
|
|
|
|
- name: Build RPM package
|
|
run: |
|
|
cargo generate-rpm --target x86_64-unknown-linux-musl \
|
|
--output target/release/kingfisher-linux-x64.rpm
|
|
|
|
- name: Move artifact to dist
|
|
shell: bash
|
|
run: |
|
|
mkdir -p dist
|
|
cp target/release/kingfisher-linux-x64.tgz dist/
|
|
cp target/release/kingfisher-linux-x64.deb dist/
|
|
cp target/release/kingfisher-linux-x64.rpm dist/
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: kingfisher-linux-x64.tgz
|
|
path: dist/kingfisher-linux-x64.tgz
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: kingfisher-linux-x64.deb
|
|
path: dist/kingfisher-linux-x64.deb
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: kingfisher-linux-x64.rpm
|
|
path: dist/kingfisher-linux-x64.rpm
|
|
|
|
linux-arm64:
|
|
name: Linux arm64
|
|
runs-on: ubuntu-24.04-arm
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: 1.88.0
|
|
profile: minimal
|
|
override: true
|
|
|
|
- uses: swatinem/rust-cache@v2
|
|
|
|
- name: Install packaging tools
|
|
run: cargo install cargo-deb cargo-generate-rpm
|
|
|
|
- name: Build (Makefile linux-arm64)
|
|
run: make linux-arm64
|
|
|
|
- name: Build Debian package
|
|
run: |
|
|
cargo deb --no-build --target aarch64-unknown-linux-musl \
|
|
--output target/release/kingfisher-linux-arm64.deb
|
|
|
|
- name: Build RPM package
|
|
run: |
|
|
cargo generate-rpm --target aarch64-unknown-linux-musl \
|
|
--output target/release/kingfisher-linux-arm64.rpm
|
|
|
|
- name: Move artifact to dist
|
|
shell: bash
|
|
run: |
|
|
mkdir -p dist
|
|
cp target/release/kingfisher-linux-arm64.tgz dist/
|
|
cp target/release/kingfisher-linux-arm64.deb dist/
|
|
cp target/release/kingfisher-linux-arm64.rpm dist/
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: kingfisher-linux-arm64.tgz
|
|
path: dist/kingfisher-linux-arm64.tgz
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: kingfisher-linux-arm64.deb
|
|
path: dist/kingfisher-linux-arm64.deb
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: kingfisher-linux-arm64.rpm
|
|
path: dist/kingfisher-linux-arm64.rpm
|
|
|
|
macos-x64:
|
|
name: macOS x64
|
|
runs-on: macos-13
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: 1.88.0
|
|
profile: minimal
|
|
override: true
|
|
|
|
- uses: swatinem/rust-cache@v2
|
|
|
|
- name: Build Darwin x64
|
|
run: make darwin-x64
|
|
- name: Run tests
|
|
run: make tests
|
|
|
|
- name: Move artifacts to dist
|
|
shell: bash
|
|
run: |
|
|
mkdir -p dist
|
|
cp target/release/kingfisher-darwin-x64.tgz dist/
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: kingfisher-darwin-x64.tgz
|
|
path: dist/kingfisher-darwin-x64.tgz
|
|
|
|
|
|
macos-arm64:
|
|
name: macOS arm64
|
|
runs-on: macos-14
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: 1.88.0
|
|
profile: minimal
|
|
override: true
|
|
|
|
- uses: swatinem/rust-cache@v2
|
|
|
|
- name: Build Darwin arm64
|
|
run: make darwin-arm64
|
|
- name: Run tests
|
|
run: make tests
|
|
|
|
- name: Move artifacts to dist
|
|
shell: bash
|
|
run: |
|
|
mkdir -p dist
|
|
cp target/release/kingfisher-darwin-arm64.tgz dist/
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: kingfisher-darwin-arm64.tgz
|
|
path: dist/kingfisher-darwin-arm64.tgz
|
|
|
|
|
|
# ──────────────── Windows ────────────────
|
|
windows:
|
|
name: Windows x64
|
|
runs-on: windows-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: 1.88.0
|
|
profile: minimal
|
|
override: true
|
|
|
|
- name: Cache vcpkg artifacts
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
C:\vcpkg\buildtrees
|
|
C:\vcpkg\packages
|
|
C:\vcpkg\installed
|
|
key: ${{ runner.os }}-vcpkg-${{ hashFiles('vcpkg.json', 'vcpkg-configuration.cmake') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-vcpkg-
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
- name: Build
|
|
run: .\buildwin.bat -force
|
|
shell: cmd
|
|
|
|
- name: Run tests
|
|
shell: pwsh
|
|
run: |
|
|
if (-not (Get-Command cargo-nextest -ErrorAction SilentlyContinue)) {
|
|
cargo install --locked cargo-nextest
|
|
}
|
|
Write-Host "▶ cargo nextest run --release --workspace --all-targets"
|
|
cargo nextest run --release --workspace --all-targets
|
|
|
|
- name: Move artifact to dist
|
|
shell: bash
|
|
run: |
|
|
mkdir -p dist
|
|
cp target/release/kingfisher-windows-x64.zip dist/
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: kingfisher-windows-x64
|
|
path: dist/kingfisher-*windows-x64*.*
|
|
|
|
release:
|
|
name: Public GitHub Release
|
|
needs: [linux-x64, linux-arm64, windows, macos-x64, macos-arm64]
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Read version from Cargo.toml
|
|
id: version
|
|
run: |
|
|
VERSION=$(grep -m1 '^version\s*=' Cargo.toml | cut -d '"' -f2)
|
|
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
path: target/release/kingfisher-*
|
|
merge-multiple: true
|
|
- name: Extract latest changelog section
|
|
run: |
|
|
awk '
|
|
BEGIN { grabbing = 0 }
|
|
/^## \[/ {
|
|
if (grabbing) exit; # already grabbed latest entry
|
|
grabbing = 1
|
|
}
|
|
grabbing { print }
|
|
' CHANGELOG.md > .latest_changelog.md
|
|
|
|
# ── create the release using just that snippet ─────────────────────
|
|
- name: Create release & upload assets
|
|
uses: ncipollo/release-action@v1
|
|
with:
|
|
tag: v${{ steps.version.outputs.version }}
|
|
name: "Kingfisher v${{ steps.version.outputs.version }}"
|
|
bodyFile: .latest_changelog.md # ← only the most-recent entry
|
|
generateReleaseNotes: false
|
|
artifacts: target/release/** |