yazi/.github/workflows/release.yml

80 lines
2.5 KiB
YAML
Raw Normal View History

name: Release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
jobs:
2023-10-21 08:27:26 +03:00
release:
permissions:
contents: write
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
- os: windows-latest
target: x86_64-pc-windows-msvc
- os: macos-latest
target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin
2023-10-21 08:27:26 +03:00
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
2023-10-21 08:27:26 +03:00
- name: Add aarch64 target
if: contains(fromJson('["aarch64-unknown-linux-gnu", "aarch64-apple-darwin"]'), matrix.target)
run: rustup target add ${{ matrix.target }}
- 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
2023-10-21 08:27:26 +03:00
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
- name: Build
2023-10-22 11:34:20 +03:00
env:
YAZI_GEN_COMPLETIONS: true
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: /usr/bin/aarch64-linux-gnu-gcc
run: cargo build --release --locked --target ${{ matrix.target }}
2023-10-21 08:27:26 +03:00
- name: Pack artifacts [Linux & macOS]
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
env:
2023-10-21 08:27:26 +03:00
TARGET_NAME: yazi-${{ matrix.target }}
run: |
2023-10-21 08:27:26 +03:00
mkdir $TARGET_NAME
cp target/${{ matrix.target }}/release/yazi $TARGET_NAME
2023-10-22 13:54:24 +03:00
cp -r yazi-config/completions $TARGET_NAME
2023-10-21 08:27:26 +03:00
cp README.md LICENSE $TARGET_NAME
zip -r $TARGET_NAME.zip $TARGET_NAME
2023-10-21 08:27:26 +03:00
- name: Pack artifacts [Windows]
if: matrix.os == 'windows-latest'
env:
2023-10-21 08:27:26 +03:00
TARGET_NAME: yazi-${{ matrix.target }}
run: |
2023-10-21 08:27:26 +03:00
New-Item -ItemType Directory -Path ${env:TARGET_NAME}
Copy-Item -Path "target\${{ matrix.target }}\release\yazi.exe" -Destination ${env:TARGET_NAME}
2023-10-22 13:54:24 +03:00
Copy-Item -Path "yazi-config\completions" -Destination ${env:TARGET_NAME} -Recurse
2023-10-21 08:27:26 +03:00
Copy-Item -Path "README.md", "LICENSE" -Destination ${env:TARGET_NAME}
Compress-Archive -Path ${env:TARGET_NAME} -DestinationPath "${env:TARGET_NAME}.zip"
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
2023-10-21 08:27:26 +03:00
draft: true
files: yazi-${{ matrix.target }}.zip
2023-10-21 08:27:26 +03:00
generate_release_notes: true