on:
push:
tags:
- '*'
name: Publish
jobs:
test:
name: Test
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache cargo dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Check formatting
run: cargo fmt --all -- --check
- name: Run clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Build
run: cargo build --verbose
- name: Run all tests
run: cargo test --verbose
audit:
name: Audit
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/audit@v1
crates_io_publish:
name: Publish (crates.io)
needs:
- test
- audit
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: cargo-release Cache
id: cargo_release_cache
uses: actions/cache@v4
with:
path: ~/.cargo/bin/cargo-release
key: ${{ runner.os }}-cargo-release
- run: cargo install cargo-release
if: steps.cargo_release_cache.outputs.cache-hit != 'true'
- run: cargo package
- run: cargo release publish --no-confirm --execute --allow-branch HEAD
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
build_binaries:
name: Build release binaries
needs:
- test
- audit
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
- target: x86_64-apple-darwin
os: macos-latest
- target: aarch64-apple-darwin
os: macos-latest
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Build binary
run: cargo build --release --target ${{ matrix.target }}
- name: Package binary (Unix)
if: matrix.os != 'windows-latest'
run: |
cd target/${{ matrix.target }}/release
tar czf nu_plugin_ws-${{ github.ref_name }}-${{ matrix.target }}.tar.gz nu_plugin_ws
mv nu_plugin_ws-${{ github.ref_name }}-${{ matrix.target }}.tar.gz ../../../
- name: Package binary (Windows)
if: matrix.os == 'windows-latest'
run: |
cd target/${{ matrix.target }}/release
7z a nu_plugin_ws-${{ github.ref_name }}-${{ matrix.target }}.zip nu_plugin_ws.exe
mv nu_plugin_ws-${{ github.ref_name }}-${{ matrix.target }}.zip ../../../
- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: nu_plugin_ws-${{ matrix.target }}
path: nu_plugin_ws-${{ github.ref_name }}-${{ matrix.target }}.*
github_release:
name: Create GitHub Release
needs:
- test
- audit
- build_binaries
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create Release
uses: softprops/action-gh-release@v2
with:
name: Release ${{ github.ref_name }}
body: |
Release ${{ github.ref_name }}
## Installation
Download the appropriate binary for your platform from the assets below.
### Using cargo
```bash
cargo install nu_plugin_ws
```
### Manual installation
1. Download the binary for your platform
2. Extract it to a directory in your PATH
3. Register with nushell: `plugin add ./nu_plugin_ws`
## Changes
See the [commit history](https://github.com/${{ github.repository }}/commits/${{ github.ref_name }}) for details.
files: artifacts/*/nu_plugin_ws-*
draft: false
prerelease: false