diff --git a/.github/workflows/release-pkg.nu b/.github/workflows/release-pkg.nu index 576aa32a05..8d0c4868c1 100755 --- a/.github/workflows/release-pkg.nu +++ b/.github/workflows/release-pkg.nu @@ -51,7 +51,19 @@ let dist = $'($env.GITHUB_WORKSPACE)/output' let version = (open Cargo.toml | get package.version) print $'Debugging info:' -print { version: $version, bin: $bin, os: $os, target: $target, src: $src, flags: $flags, dist: $dist }; hr-line -b +print { version: $version, bin: $bin, os: $os, releaseType: $env.RELEASE_TYPE, target: $target, src: $src, flags: $flags, dist: $dist }; hr-line -b + +# Rename the full release name so that we won't break the existing scripts for standard release downloading, such as: +# curl -s https://api.github.com/repos/chmln/sd/releases/latest | grep browser_download_url | cut -d '"' -f 4 | grep x86_64-unknown-linux-musl +const FULL_RLS_NAMING = { + x86_64-apple-darwin: 'x86_64-darwin-full', + aarch64-apple-darwin: 'aarch64-darwin-full', + x86_64-unknown-linux-gnu: 'x86_64-linux-gnu-full', + x86_64-pc-windows-msvc: 'x86_64-windows-msvc-full', + x86_64-unknown-linux-musl: 'x86_64-linux-musl-full', + aarch64-unknown-linux-gnu: 'aarch64-linux-gnu-full', + aarch64-pc-windows-msvc: 'aarch64-windows-msvc-full', +} # $env @@ -141,7 +153,11 @@ cd $dist; print $'(char nl)Creating release archive...'; hr-line if $os in [$USE_UBUNTU, 'macos-latest'] { let files = (ls | get name) - let dest = $'($bin)-($version)-($target)' + let dest = ( + if $env.RELEASE_TYPE == 'full' { + $'($bin)-($version)-($FULL_RLS_NAMING | get $target)' + } else { $'($bin)-($version)-($target)' } + ) let archive = $'($dist)/($dest).tar.gz' mkdir $dest @@ -156,7 +172,11 @@ if $os in [$USE_UBUNTU, 'macos-latest'] { } else if $os == 'windows-latest' { - let releaseStem = $'($bin)-($version)-($target)' + let releaseStem = ( + if $env.RELEASE_TYPE == 'full' { + $'($bin)-($version)-($FULL_RLS_NAMING | get $target)' + } else { $'($bin)-($version)-($target)' } + ) print $'(char nl)Download less related stuffs...'; hr-line aria2c https://github.com/jftuga/less-Windows/releases/download/less-v608/less.exe -o less.exe diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 173adf2387..56500632b9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,8 +14,8 @@ defaults: shell: bash jobs: - all: - name: All + standard: + name: Std strategy: matrix: @@ -80,13 +80,11 @@ jobs: - name: Setup Rust toolchain and cache uses: actions-rust-lang/setup-rust-toolchain@v1.5.0 - with: - rustflags: '' - name: Setup Nushell uses: hustcer/setup-nu@v3.6 with: - version: 0.84.0 + version: 0.85.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -94,6 +92,94 @@ jobs: id: nu run: nu .github/workflows/release-pkg.nu env: + RELEASE_TYPE: standard + OS: ${{ matrix.os }} + REF: ${{ github.ref }} + TARGET: ${{ matrix.target }} + _EXTRA_: ${{ matrix.extra }} + TARGET_RUSTFLAGS: ${{ matrix.target_rustflags }} + + # REF: https://github.com/marketplace/actions/gh-release + - name: Publish Archive + uses: softprops/action-gh-release@v0.1.15 + if: ${{ startsWith(github.ref, 'refs/tags/') }} + with: + files: ${{ steps.nu.outputs.archive }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + full: + name: Full + + strategy: + fail-fast: false + matrix: + target: + - aarch64-apple-darwin + - x86_64-apple-darwin + - x86_64-pc-windows-msvc + - aarch64-pc-windows-msvc + - x86_64-unknown-linux-gnu + - x86_64-unknown-linux-musl + - aarch64-unknown-linux-gnu + extra: ['bin'] + include: + - target: aarch64-apple-darwin + os: macos-latest + target_rustflags: '--features=dataframe,extra' + - target: x86_64-apple-darwin + os: macos-latest + target_rustflags: '--features=dataframe,extra' + - target: x86_64-pc-windows-msvc + extra: 'bin' + os: windows-latest + target_rustflags: '--features=dataframe,extra' + - target: x86_64-pc-windows-msvc + extra: msi + os: windows-latest + target_rustflags: '--features=dataframe,extra' + - target: aarch64-pc-windows-msvc + extra: 'bin' + os: windows-latest + target_rustflags: '--features=dataframe,extra' + - target: aarch64-pc-windows-msvc + extra: msi + os: windows-latest + target_rustflags: '--features=dataframe,extra' + - target: x86_64-unknown-linux-gnu + os: ubuntu-20.04 + target_rustflags: '--features=dataframe,extra' + - target: x86_64-unknown-linux-musl + os: ubuntu-20.04 + target_rustflags: '--features=dataframe,extra' + - target: aarch64-unknown-linux-gnu + os: ubuntu-20.04 + target_rustflags: '--features=dataframe,extra' + + runs-on: ${{matrix.os}} + + steps: + - uses: actions/checkout@v4 + + - name: Update Rust Toolchain Target + run: | + echo "targets = ['${{matrix.target}}']" >> rust-toolchain.toml + + - name: Setup Rust toolchain and cache + uses: actions-rust-lang/setup-rust-toolchain@v1.5.0 + + - name: Setup Nushell + uses: hustcer/setup-nu@v3.6 + with: + version: 0.85.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Release Nu Binary + id: nu + run: nu .github/workflows/release-pkg.nu + env: + RELEASE_TYPE: full OS: ${{ matrix.os }} REF: ${{ github.ref }} TARGET: ${{ matrix.target }}