Draft #441
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Draft | |
on: | |
push: | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+" | |
schedule: | |
- cron: "0 */6 * * *" | |
workflow_dispatch: | |
jobs: | |
build-unix: | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
- os: ubuntu-latest | |
target: aarch64-unknown-linux-gnu | |
- os: macos-latest | |
target: x86_64-apple-darwin | |
- os: macos-latest | |
target: aarch64-apple-darwin | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install gcc-aarch64-linux-gnu | |
if: matrix.target == 'aarch64-unknown-linux-gnu' | |
run: | | |
sudo apt-get update && sudo apt-get install -yq gcc-aarch64-linux-gnu | |
echo "JEMALLOC_SYS_WITH_LG_PAGE=16" >> $GITHUB_ENV | |
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=/usr/bin/aarch64-linux-gnu-gcc" >> $GITHUB_ENV | |
- name: Setup Rust toolchain | |
run: rustup toolchain install stable --profile minimal --target ${{ matrix.target }} | |
- name: Setup Rust cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
prefix-key: rust | |
shared-key: ${{ matrix.target }}@release | |
- name: Build | |
run: ./scripts/build.sh ${{ matrix.target }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: yazi-${{ matrix.target }}.zip | |
path: yazi-${{ matrix.target }}.zip | |
build-windows: | |
strategy: | |
matrix: | |
include: | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
- os: windows-latest | |
target: aarch64-pc-windows-msvc | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Rust toolchain | |
run: rustup toolchain install stable --profile minimal --target ${{ matrix.target }} | |
- name: Setup Rust cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
prefix-key: rust | |
shared-key: ${{ matrix.target }}@release | |
- name: Build | |
env: | |
YAZI_GEN_COMPLETIONS: true | |
run: | | |
cargo build -p yazi-cli --release --locked --target ${{ matrix.target }} | |
cargo build -p yazi-fm --release --locked --target ${{ matrix.target }} | |
- name: Pack artifact | |
if: matrix.os == 'windows-latest' | |
env: | |
TARGET_NAME: yazi-${{ matrix.target }} | |
run: | | |
New-Item -ItemType Directory -Path ${env:TARGET_NAME} | |
Copy-Item -Path "target\${{ matrix.target }}\release\ya.exe" -Destination ${env:TARGET_NAME} | |
Copy-Item -Path "target\${{ matrix.target }}\release\yazi.exe" -Destination ${env:TARGET_NAME} | |
Copy-Item -Path "yazi-boot\completions" -Destination ${env:TARGET_NAME} -Recurse | |
Copy-Item -Path "README.md", "LICENSE" -Destination ${env:TARGET_NAME} | |
Compress-Archive -Path ${env:TARGET_NAME} -DestinationPath "${env:TARGET_NAME}.zip" | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: yazi-${{ matrix.target }}.zip | |
path: yazi-${{ matrix.target }}.zip | |
build-musl: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- target: x86_64-unknown-linux-musl | |
image: rust-musl-cross:x86_64-musl | |
- target: aarch64-unknown-linux-musl | |
image: rust-musl-cross:aarch64-musl | |
container: | |
image: docker://ghcr.io/rust-cross/${{ matrix.image }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Add musl target | |
run: rustup target add ${{ matrix.target }} | |
- name: Setup Rust cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
prefix-key: rust | |
shared-key: ${{ matrix.target }}@release | |
- name: Build | |
run: ./scripts/build.sh ${{ matrix.target }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: yazi-${{ matrix.target }}.zip | |
path: yazi-${{ matrix.target }}.zip | |
build-snap: | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Rust cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
prefix-key: rust | |
shared-key: ${{ matrix.target }}@release | |
- name: Build | |
uses: snapcore/action-build@v1 | |
- name: Rename snap | |
run: mv yazi_*.snap yazi-${{ matrix.target }}.snap | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: yazi-${{ matrix.target }}.snap | |
path: yazi-${{ matrix.target }}.snap | |
draft: | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
needs: [build-unix, build-windows, build-musl, build-snap] | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
merge-multiple: true | |
- name: Draft | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
draft: true | |
files: | | |
yazi-*.zip | |
yazi-*.snap | |
generate_release_notes: true | |
nightly: | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
needs: [build-unix, build-windows, build-musl, build-snap] | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
merge-multiple: true | |
- run: | | |
echo 'NIGHTLY_BODY<<EOF' >> $GITHUB_ENV | |
echo "From commit: ${GITHUB_SHA:0:8}" >> $GITHUB_ENV | |
echo "Generated on: $(date -u +"%Y-%m-%d %H:%M") UTC" >> $GITHUB_ENV | |
echo "EOF" >> $GITHUB_ENV | |
- name: Nightly | |
uses: softprops/action-gh-release@v1 | |
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' | |
with: | |
tag_name: nightly | |
prerelease: true | |
files: | | |
yazi-*.zip | |
yazi-*.snap | |
name: Nightly Build | |
body: ${{ env.NIGHTLY_BODY }} |