name: Release on: push: tags: - "v[0-9]+.[0-9]+.[0-9]+" jobs: release: permissions: contents: write strategy: matrix: include: - os: ubuntu-latest target: x86_64-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 runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 - name: Add aarch64 target if: matrix.target == 'aarch64-apple-darwin' run: rustup target add aarch64-apple-darwin - name: Cache dependencies uses: Swatinem/rust-cache@v2 - name: Build env: YAZI_GEN_COMPLETIONS: true run: cargo build --release --locked --target ${{ matrix.target }} - name: Pack artifacts [Linux & macOS] if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' env: TARGET_NAME: yazi-${{ matrix.target }} run: | mkdir $TARGET_NAME cp target/${{ matrix.target }}/release/yazi $TARGET_NAME cp -r yazi-config/completions $TARGET_NAME cp README.md LICENSE $TARGET_NAME zip -r $TARGET_NAME.zip $TARGET_NAME - name: Pack artifacts [Windows] 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\yazi.exe" -Destination ${env:TARGET_NAME} Copy-Item -Path "yazi-config\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: Release uses: softprops/action-gh-release@v1 if: startsWith(github.ref, 'refs/tags/') with: draft: true files: yazi-${{ matrix.target }}.zip generate_release_notes: true