From a26a01c8d0bf6118ad5b17754e9bd36036d02ecb Mon Sep 17 00:00:00 2001 From: Justin Ma Date: Sat, 23 Sep 2023 09:41:08 +0800 Subject: [PATCH] Add full releases of Nu binaries along with the standard releases (#10457) # Description Add full releases of Nu binaries along with the standard releases, close: https://github.com/nushell/nushell/issues/10322 A full release means: 1. Build with `--features=dataframe,extra` flag 2. Contains `-full` in the package name ### **A test release could be found in the nushell/nightly Repo: https://github.com/nushell/nightly/releases/tag/v0.85.1** The action running log: https://github.com/nushell/nightly/actions/runs/6260611553 # User-Facing Changes Will attach the following release packages along with the official ones as before: 1. nu-*-aarch64-darwin-full.tar.gz 2. nu-*-aarch64-linux-gnu-full.tar.gz 3. nu-*-aarch64-windows-msvc-full.msi 4. nu-*-aarch64-windows-msvc-full.zip 5. nu-*-x86_64-darwin-full.tar.gz 6. nu-*-x86_64-linux-gnu-full.tar.gz 7. nu-*-x86_64-linux-musl-full.tar.gz 8. nu-*-x86_64-windows-msvc-full.msi 9. nu-*-x86_64-windows-msvc-full.zip --- .github/workflows/release-pkg.nu | 26 ++++++++- .github/workflows/release.yml | 96 ++++++++++++++++++++++++++++++-- 2 files changed, 114 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release-pkg.nu b/.github/workflows/release-pkg.nu index 576aa32a0..8d0c4868c 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 173adf238..56500632b 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 }}