From cd4e8e92ea1b19408e5aa14ff9dab5888c876fe9 Mon Sep 17 00:00:00 2001 From: DualFroz Date: Thu, 23 Jul 2026 07:24:58 +0200 Subject: [PATCH] feat: respect $VULP_REPO env override for update-check; add CI workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The compiled binary's update-check tile hardcoded dualfroz/fxg with no way to override it, unlike the install scripts which already honor $VULP_REPO — a fork or a future repo rename needed a rebuild just to fix the tile. Also add .github/workflows/ci.yml (build + clippy -D warnings + test on push/PR): the only existing workflow was the tag-triggered release build, so nothing gated PRs before merge. --- .github/workflows/ci.yml | 30 ++++++++++++++++++++++++++++++ src/release_info.rs | 12 ++++++++---- 2 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..f6886ff --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,30 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + +jobs: + check: + strategy: + matrix: + os: [ubuntu-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + - uses: dtolnay/rust-toolchain@stable + with: + components: clippy + + - uses: Swatinem/rust-cache@v2 + + - name: Build + run: cargo build --all-targets + + - name: Clippy + run: cargo clippy --all-targets -- -D warnings + + - name: Test + run: cargo test diff --git a/src/release_info.rs b/src/release_info.rs index 03d56ae..30085b7 100644 --- a/src/release_info.rs +++ b/src/release_info.rs @@ -7,8 +7,12 @@ use serde_json::Value; /// The GitHub repo this binary is published from. Shared with the installer /// scripts (`install/vulp-installer.sh`/`.ps1`), which hit the same -/// `releases/latest` endpoint to fetch the newest build. -pub const VULP_REPO: &str = "dualfroz/fxg"; +/// `releases/latest` endpoint to fetch the newest build. Overridable via +/// `$VULP_REPO` (same env var the installers already honor), so a fork or a +/// future rename doesn't require a rebuild just to fix the update-check tile. +fn vulp_repo() -> String { + std::env::var("VULP_REPO").unwrap_or_else(|_| "dualfroz/fxg".to_string()) +} /// One GitHub release's metadata, trimmed to what the update tile shows. #[derive(Debug, Clone)] @@ -43,14 +47,14 @@ async fn fetch_release(url: &str) -> Result { /// Info about the very latest release on GitHub, regardless of what's running. pub async fn fetch_latest() -> Result { - fetch_release(&format!("https://api.github.com/repos/{VULP_REPO}/releases/latest")).await + fetch_release(&format!("https://api.github.com/repos/{}/releases/latest", vulp_repo())).await } /// Info about the release matching the version actually running, if one was /// tagged (`v{CARGO_PKG_VERSION}`) — lets the tile show who shipped *this* /// build and when, not just what's newest. pub async fn fetch_current(version: &str) -> Result { - fetch_release(&format!("https://api.github.com/repos/{VULP_REPO}/releases/tags/v{version}")).await + fetch_release(&format!("https://api.github.com/repos/{}/releases/tags/v{version}", vulp_repo())).await } /// The `created_at` date (YYYY-MM-DD) of a GitHub user/org — for the General