mirror of
https://github.com/sxyazi/yazi.git
synced 2026-05-13 08:16:40 +00:00
253 lines
7.4 KiB
YAML
253 lines
7.4 KiB
YAML
name: Draft
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
tags: ["v[0-9]+.[0-9]+.[0-9]+"]
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
SCCACHE_GHA_ENABLED: true
|
|
|
|
jobs:
|
|
build-unix:
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- os: ubuntu-latest
|
|
target: x86_64-unknown-linux-gnu
|
|
- os: ubuntu-latest
|
|
target: aarch64-unknown-linux-gnu
|
|
gcc: gcc-aarch64-linux-gnu
|
|
- os: ubuntu-latest
|
|
target: i686-unknown-linux-gnu
|
|
gcc: gcc-i686-linux-gnu
|
|
- os: ubuntu-latest
|
|
target: riscv64gc-unknown-linux-gnu
|
|
gcc: gcc-riscv64-linux-gnu
|
|
- os: ubuntu-latest
|
|
target: sparc64-unknown-linux-gnu
|
|
gcc: gcc-sparc64-linux-gnu
|
|
- os: macos-latest
|
|
target: x86_64-apple-darwin
|
|
- os: macos-latest
|
|
target: aarch64-apple-darwin
|
|
runs-on: ${{ matrix.os }}
|
|
env:
|
|
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
|
|
CARGO_TARGET_I686_UNKNOWN_LINUX_GNU_LINKER: i686-linux-gnu-gcc
|
|
CARGO_TARGET_RISCV64GC_UNKNOWN_LINUX_GNU_LINKER: riscv64-linux-gnu-gcc
|
|
CARGO_TARGET_SPARC64_UNKNOWN_LINUX_GNU_LINKER: sparc64-linux-gnu-gcc
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install gcc
|
|
if: matrix.gcc != ''
|
|
run: sudo apt update && sudo apt install -yq ${{ matrix.gcc }}
|
|
|
|
- name: Setup Rust toolchain
|
|
run: rustup toolchain install stable --profile minimal --target ${{ matrix.target }}
|
|
|
|
- name: Setup sccache
|
|
uses: mozilla-actions/sccache-action@v0.0.9
|
|
|
|
- name: Build
|
|
run: ./scripts/build.sh ${{ matrix.target }}
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ matrix.target }}
|
|
path: |
|
|
yazi-${{ matrix.target }}.zip
|
|
yazi-${{ matrix.target }}.deb
|
|
|
|
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 }}
|
|
env:
|
|
RUSTC_WRAPPER: sccache
|
|
YAZI_GEN_COMPLETIONS: true
|
|
CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_LINKER: lld-link.exe
|
|
CARGO_TARGET_AARCH64_PC_WINDOWS_MSVC_LINKER: lld-link.exe
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup Rust toolchain
|
|
run: rustup toolchain install stable --profile minimal --target ${{ matrix.target }}
|
|
|
|
- name: Setup sccache
|
|
uses: mozilla-actions/sccache-action@v0.0.9
|
|
|
|
- name: Build
|
|
run: cargo build --profile release-windows --locked --target ${{ matrix.target }}
|
|
|
|
- name: Pack artifact
|
|
env:
|
|
TARGET_NAME: yazi-${{ matrix.target }}
|
|
run: |
|
|
New-Item -ItemType Directory -Path ${env:TARGET_NAME}
|
|
Copy-Item -Path "target\${{ matrix.target }}\release-windows\ya.exe" -Destination ${env:TARGET_NAME}
|
|
Copy-Item -Path "target\${{ matrix.target }}\release-windows\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: ${{ matrix.target }}
|
|
path: yazi-${{ matrix.target }}.zip
|
|
|
|
build-musl:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- target: x86_64-unknown-linux-musl
|
|
- target: aarch64-unknown-linux-musl
|
|
container:
|
|
image: docker://ghcr.io/cross-rs/${{ matrix.target }}:edge
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: ${{ matrix.target }}
|
|
|
|
- name: Setup sccache
|
|
uses: mozilla-actions/sccache-action@v0.0.9
|
|
|
|
- name: Build
|
|
run: ./scripts/build.sh ${{ matrix.target }}
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ matrix.target }}
|
|
path: |
|
|
yazi-${{ matrix.target }}.zip
|
|
yazi-${{ matrix.target }}.deb
|
|
|
|
build-snap:
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- os: ubuntu-latest
|
|
arch: amd64
|
|
- os: ubuntu-24.04-arm
|
|
arch: arm64
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Setup LXD
|
|
uses: canonical/setup-lxd@v0.1.3
|
|
|
|
- name: Setup snapcraft
|
|
run: sudo snap install --classic snapcraft
|
|
|
|
- name: Build snap
|
|
run: snapcraft --verbose
|
|
|
|
- name: Rename snap
|
|
run: mv yazi_*.snap yazi-${{ matrix.arch }}.snap
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: snap-${{ matrix.arch }}
|
|
path: yazi-${{ matrix.arch }}.snap
|
|
|
|
snap:
|
|
runs-on: ubuntu-latest
|
|
needs: [build-snap]
|
|
steps:
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
pattern: snap-*
|
|
merge-multiple: true
|
|
|
|
- name: Setup snapcraft
|
|
run: sudo snap install --classic snapcraft
|
|
|
|
- name: Push snap to candidate channel
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
env:
|
|
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }}
|
|
run: |
|
|
parallel 'snapcraft upload -v --release latest/candidate {}' ::: yazi-*.snap || true
|
|
|
|
- name: Push snap to edge channel
|
|
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
env:
|
|
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }}
|
|
run: |
|
|
parallel 'snapcraft upload -v --release latest/edge {}' ::: yazi-*.snap || true
|
|
|
|
draft:
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
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@v2
|
|
with:
|
|
draft: true
|
|
files: |
|
|
yazi-*.zip
|
|
yazi-*.deb
|
|
yazi-*.snap
|
|
generate_release_notes: true
|
|
|
|
nightly:
|
|
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
permissions:
|
|
contents: write
|
|
runs-on: ubuntu-latest
|
|
needs: [build-unix, build-windows, build-musl, build-snap]
|
|
steps:
|
|
- 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
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
merge-multiple: true
|
|
|
|
- name: Update the tag
|
|
run: |
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
git tag --force nightly && git push --force origin tag nightly
|
|
|
|
- name: Nightly
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: nightly
|
|
prerelease: true
|
|
files: |
|
|
yazi-*.zip
|
|
yazi-*.deb
|
|
yazi-*.snap
|
|
name: Nightly Build
|
|
body: ${{ env.NIGHTLY_BODY }}
|
|
target_commitish: ${{ github.sha }}
|