Skip to content
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
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:

steps:
- uses: actions/checkout@v4

- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
Expand All @@ -83,6 +83,8 @@ jobs:

- name: Build release binary
run: cargo build --release --target ${{ matrix.target }}
env:
CLI_VERSION: ${{ needs.version.outputs.new_tag }}

- name: Prepare artifact
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "popcorn-cli"
version = "0.1.0"
version = "0.0.0-dev"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
7 changes: 7 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
fn main() {
// CI sets CLI_VERSION env var from git tag, otherwise show "dev"
let version = std::env::var("CLI_VERSION")
.map(|v| v.trim_start_matches('v').to_string())
.unwrap_or_else(|_| "dev".to_string());
println!("cargo:rustc-env=CLI_VERSION={}", version);
}
2 changes: 1 addition & 1 deletion src/cmd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ fn load_config() -> Result<Config> {
}

#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
#[command(author, version = env!("CLI_VERSION"), about, long_about = None)]
pub struct Cli {
#[command(subcommand)]
command: Option<Commands>,
Expand Down