nushell/.github/workflows/release.yml
2021-11-15 16:19:44 -06:00

558 lines
18 KiB
YAML

name: Create Release Draft
on:
workflow_dispatch:
push:
tags: ['[0-9]+.[0-9]+.[0-9]+*']
jobs:
linux:
name: Build Linux
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Install libxcb
run: sudo apt-get install libxcb-composite0-dev
- name: Set up cargo
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --all --features=extra
- name: Compress binaries (nu)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu
- name: Compress binaries (nu_plugin_inc)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_inc
- name: Compress binaries (nu_plugin_match)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_match
- name: Compress binaries (nu_plugin_textview)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_textview
- name: Compress binaries (nu_plugin_binaryview)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_binaryview
- name: Compress binaries (nu_plugin_chart_bar)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_chart_bar
- name: Compress binaries (nu_plugin_chart_line)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_chart_line
- name: Compress binaries (nu_plugin_from_bson)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_from_bson
- name: Compress binaries (nu_plugin_from_sqlite)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_from_sqlite
- name: Compress binaries (nu_plugin_from_mp4)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_from_mp4
- name: Compress binaries (nu_plugin_query_json)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_query_json
- name: Compress binaries (nu_plugin_s3)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_s3
- name: Compress binaries (nu_plugin_selector)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_selector
- name: Compress binaries (nu_plugin_start)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_start
- name: Compress binaries (nu_plugin_to_bson)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_to_bson
- name: Compress binaries (nu_plugin_to_sqlite)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_to_sqlite
- name: Compress binaries (nu_plugin_tree)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_tree
- name: Compress binaries (nu_plugin_xpath)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_xpath
- name: Create output directory
run: mkdir output
- name: Copy files to output
run: |
cp target/release/nu target/release/nu_plugin_* output/
cp README.build.txt output/README.txt
cp LICENSE output/LICENSE
rm output/*.d
rm output/nu_plugin_core_*
rm output/nu_plugin_extra_*
# Note: If OpenSSL changes, this path will need to be updated
- name: Copy OpenSSL to output
run: cp /usr/lib/x86_64-linux-gnu/libssl.so.1.1 output/
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: linux
path: output/*
macos:
name: Build macOS
runs-on: macos-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Set up cargo
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --all --features=extra
- name: Compress binaries (nu)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu
- name: Compress binaries (nu_plugin_inc)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_inc
- name: Compress binaries (nu_plugin_match)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_match
- name: Compress binaries (nu_plugin_textview)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_textview
- name: Compress binaries (nu_plugin_binaryview)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_binaryview
- name: Compress binaries (nu_plugin_chart_bar)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_chart_bar
- name: Compress binaries (nu_plugin_chart_line)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_chart_line
- name: Compress binaries (nu_plugin_from_bson)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_from_bson
- name: Compress binaries (nu_plugin_from_sqlite)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_from_sqlite
- name: Compress binaries (nu_plugin_from_mp4)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_from_mp4
- name: Compress binaries (nu_plugin_query_json)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_query_json
- name: Compress binaries (nu_plugin_s3)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_s3
- name: Compress binaries (nu_plugin_selector)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_selector
- name: Compress binaries (nu_plugin_start)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_start
- name: Compress binaries (nu_plugin_to_bson)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_to_bson
- name: Compress binaries (nu_plugin_to_sqlite)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_to_sqlite
- name: Compress binaries (nu_plugin_tree)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_tree
- name: Compress binaries (nu_plugin_xpath)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_xpath
- name: Create output directory
run: mkdir output
- name: Copy files to output
run: |
cp target/release/nu target/release/nu_plugin_* output/
cp README.build.txt output/README.txt
cp LICENSE output/LICENSE
rm output/*.d
rm output/nu_plugin_core_*
rm output/nu_plugin_extra_*
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: macos
path: output/*
windows:
name: Build Windows
runs-on: windows-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Set up cargo
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Add cargo-wix subcommand
uses: actions-rs/cargo@v1
with:
command: install
args: cargo-wix
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --all --features=extra
- name: Compress binaries (nu.exe)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu.exe
- name: Compress binaries (nu_plugin_inc.exe)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_inc.exe
- name: Compress binaries (nu_plugin_match.exe)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_match.exe
- name: Compress binaries (nu_plugin_textview.exe)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_textview.exe
- name: Compress binaries (nu_plugin_binaryview.exe)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_binaryview.exe
- name: Compress binaries (nu_plugin_chart_bar.exe)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_chart_bar.exe
- name: Compress binaries (nu_plugin_chart_line.exe)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_chart_line.exe
- name: Compress binaries (nu_plugin_from_bson.exe)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_from_bson.exe
- name: Compress binaries (nu_plugin_from_sqlite.exe)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_from_sqlite.exe
- name: Compress binaries (nu_plugin_from_mp4.exe)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_from_mp4.exe
- name: Compress binaries (nu_plugin_query_json.exe)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_query_json.exe
- name: Compress binaries (nu_plugin_s3.exe)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_s3.exe
- name: Compress binaries (nu_plugin_selector.exe)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_selector.exe
- name: Compress binaries (nu_plugin_start.exe)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_start.exe
- name: Compress binaries (nu_plugin_to_bson.exe)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_to_bson.exe
- name: Compress binaries (nu_plugin_to_sqlite.exe)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_to_sqlite.exe
- name: Compress binaries (nu_plugin_tree.exe)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_tree.exe
- name: Compress binaries (nu_plugin_xpath.exe)
uses: svenstaro/upx-action@v2
with:
file: target/release/nu_plugin_xpath.exe
- name: Create output directory
run: mkdir output
- name: Download Less Binary
run: Invoke-WebRequest -Uri "https://github.com/jftuga/less-Windows/releases/download/less-v562.0/less.exe" -OutFile "target\release\less.exe"
- name: Download Less License
run: Invoke-WebRequest -Uri "https://raw.githubusercontent.com/jftuga/less-Windows/master/LICENSE" -OutFile "target\release\LICENSE-for-less.txt"
- name: Copy files to output
run: |
cp target\release\nu.exe output\
cp LICENSE output\
cp target\release\LICENSE-for-less.txt output\
rm target\release\nu_plugin_core_*.exe
rm target\release\nu_plugin_extra_*.exe
cp target\release\nu_plugin_*.exe output\
cp README.build.txt output\README.txt
cp target\release\less.exe output\
# Note: If the version of `less.exe` needs to be changed, update this URL
# Similarly, if `less.exe` is checked into the repo, copy from the local path here
# moved this stuff down to create wix after we download less
- name: Create msi with wix
uses: actions-rs/cargo@v1
with:
command: wix
args: --no-build --nocapture --output target\wix\nushell-windows.msi
- name: Upload installer
uses: actions/upload-artifact@v2
with:
name: windows-installer
path: target\wix\nushell-windows.msi
- name: Upload zip
uses: actions/upload-artifact@v2
with:
name: windows-zip
path: output\*
release:
name: Publish Release
runs-on: ubuntu-latest
needs:
- linux
- macos
- windows
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Determine Release Info
id: info
env:
GITHUB_REF: ${{ github.ref }}
run: |
VERSION=${GITHUB_REF##*/}
MAJOR=${VERSION%%.*}
MINOR=${VERSION%.*}
MINOR=${MINOR#*.}
PATCH=${VERSION##*.}
echo "::set-output name=version::${VERSION}"
echo "::set-output name=linuxdir::nu_${MAJOR}_${MINOR}_${PATCH}_linux"
echo "::set-output name=macosdir::nu_${MAJOR}_${MINOR}_${PATCH}_macOS"
echo "::set-output name=windowsdir::nu_${MAJOR}_${MINOR}_${PATCH}_windows"
echo "::set-output name=innerdir::nushell-${VERSION}"
- name: Create Release Draft
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ steps.info.outputs.version }} Release
draft: true
- name: Create Linux Directory
run: mkdir -p ${{ steps.info.outputs.linuxdir }}/${{ steps.info.outputs.innerdir }}
- name: Download Linux Artifacts
uses: actions/download-artifact@v2
with:
name: linux
path: ${{ steps.info.outputs.linuxdir }}/${{ steps.info.outputs.innerdir }}
- name: Restore Linux File Modes
run: |
chmod 755 ${{ steps.info.outputs.linuxdir }}/${{ steps.info.outputs.innerdir }}/nu*
chmod 755 ${{ steps.info.outputs.linuxdir }}/${{ steps.info.outputs.innerdir }}/libssl*
- name: Create Linux tarball
run: tar -zcvf ${{ steps.info.outputs.linuxdir }}.tar.gz ${{ steps.info.outputs.linuxdir }}
- name: Upload Linux Artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ steps.info.outputs.linuxdir }}.tar.gz
asset_name: ${{ steps.info.outputs.linuxdir }}.tar.gz
asset_content_type: application/gzip
- name: Create macOS Directory
run: mkdir -p ${{ steps.info.outputs.macosdir }}/${{ steps.info.outputs.innerdir }}
- name: Download macOS Artifacts
uses: actions/download-artifact@v2
with:
name: macos
path: ${{ steps.info.outputs.macosdir }}/${{ steps.info.outputs.innerdir }}
- name: Restore macOS File Modes
run: chmod 755 ${{ steps.info.outputs.macosdir }}/${{ steps.info.outputs.innerdir }}/nu*
- name: Create macOS Archive
run: zip -r ${{ steps.info.outputs.macosdir }}.zip ${{ steps.info.outputs.macosdir }}
- name: Upload macOS Artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ steps.info.outputs.macosdir }}.zip
asset_name: ${{ steps.info.outputs.macosdir }}.zip
asset_content_type: application/zip
- name: Create Windows Directory
run: mkdir -p ${{ steps.info.outputs.windowsdir }}/${{ steps.info.outputs.innerdir }}
- name: Download Windows zip
uses: actions/download-artifact@v2
with:
name: windows-zip
path: ${{ steps.info.outputs.windowsdir }}/${{ steps.info.outputs.innerdir }}
- name: Show Windows Artifacts
run: ls -la ${{ steps.info.outputs.windowsdir }}/${{ steps.info.outputs.innerdir }}
- name: Create macOS Archive
run: zip -r ${{ steps.info.outputs.windowsdir }}.zip ${{ steps.info.outputs.windowsdir }}
- name: Upload Windows zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ steps.info.outputs.windowsdir }}.zip
asset_name: ${{ steps.info.outputs.windowsdir }}.zip
asset_content_type: application/zip
- name: Download Windows installer
uses: actions/download-artifact@v2
with:
name: windows-installer
path: ./
- name: Upload Windows installer
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./nushell-windows.msi
asset_name: ${{ steps.info.outputs.windowsdir }}.msi
asset_content_type: application/x-msi