Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add cli binaries #62

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/workflows/publish-cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Publish CLI

on:
workflow_dispatch:

jobs:
publish-cli:
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- platform: "macos-latest" # for Arm based macs (M1 and above).
args: "--target aarch64-apple-darwin"
name: rookie-cli-macos-aarch64
- platform: "macos-latest" # for Intel based macs.
args: "--target x86_64-apple-darwin"
name: rookie-cli-macos-x86_64
- platform: "ubuntu-22.04" # Ubuntu 22.04 x86_64 (Works on 24.04 as well)
args: ""
name: rookie-cli-linux-x86_64
- platform: "windows-latest" # Windows x86_64
args: "--target x86_64-pc-windows-msvc --features appbound"
name: rookie-cli-windows-x86_64.exe

runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4

- name: Rust cache
uses: swatinem/rust-cache@v2

- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
# Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds.
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}

- name: Build
run: cargo build --release ${{ matrix.args }}

- name: Rename Unix
run: mv target/release/rookie ${{ matrix.name }}
if: contains(matrix.platform, 'macos') || contains(matrix.platform, 'ubuntu')

- name: Rename Windows
run: Move-Item target/release/rookie.exe ${{ matrix.name }}
if: contains(matrix.platform, 'windows')

- name: Upload Unix
run: |
tag=$(git describe --tags --abbrev=0)
gh release upload $tag ${{ matrix.name }} --clobber
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: contains(matrix.platform, 'macos') || contains(matrix.platform, 'ubuntu')

- name: Upload Windows
run: |
$tag = git describe --tags --abbrev=0
gh release upload $tag ${{ matrix.name }} --clobber
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: contains(matrix.platform, 'windows')
9 changes: 8 additions & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "cli"
name = "rookie-cli"
version = "0.5.5"
edition = "2021"

Expand All @@ -9,3 +9,10 @@ tracing-subscriber = "0.3.18"
lazy_static = "1.4.0"
rookie = { path = "../rookie-rs", version = "0.5.5" }
serde_json = "1.0.107"

[features]
appbound = ["rookie/appbound"]

[[bin]]
name = "rookie"
path = "src/main.rs"