Rename the project to be gt-tool singular
This commit is contained in:
@@ -13,14 +13,14 @@ jobs:
|
|||||||
- name: Build binary crate
|
- name: Build binary crate
|
||||||
run: cargo build --release
|
run: cargo build --release
|
||||||
- name: Rename binary to include architecture
|
- name: Rename binary to include architecture
|
||||||
run: mv target/release/gt-tools target/release/gt-tools-${{ github.ref_name }}-$(arch)
|
run: mv target/release/gt-tool target/release/gt-tool-${{ github.ref_name }}-$(arch)
|
||||||
- name: Upload the program (using itself!)
|
- name: Upload the program (using itself!)
|
||||||
run: >
|
run: >
|
||||||
target/release/gt-tools-${{ github.ref_name }}-$(arch)
|
target/release/gt-tool-${{ github.ref_name }}-$(arch)
|
||||||
-u ${{ vars.DEST_GITEA }} -r ${{ vars.DEST_REPO }}
|
-u ${{ vars.DEST_GITEA }} -r ${{ vars.DEST_REPO }}
|
||||||
upload-release
|
upload-release
|
||||||
"${{ github.ref_name }}"
|
"${{ github.ref_name }}"
|
||||||
target/release/gt-tools-${{ github.ref_name }}-$(arch)
|
target/release/gt-tool-${{ github.ref_name }}-$(arch)
|
||||||
env:
|
env:
|
||||||
RELEASE_KEY_GITEA: ${{ secrets.RELEASE_KEY_GITEA }}
|
RELEASE_KEY_GITEA: ${{ secrets.RELEASE_KEY_GITEA }}
|
||||||
...
|
...
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "gt-tools"
|
name = "gt-tool"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
|
|||||||
22
src/main.rs
22
src/main.rs
@@ -1,5 +1,5 @@
|
|||||||
use gt_tools::cli::Args;
|
use gt_tool::cli::Args;
|
||||||
use gt_tools::structs::release::{CreateReleaseOption, Release};
|
use gt_tool::structs::release::{CreateReleaseOption, Release};
|
||||||
|
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
|
|
||||||
@@ -7,7 +7,7 @@ use reqwest::header;
|
|||||||
use reqwest::header::ACCEPT;
|
use reqwest::header::ACCEPT;
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> Result<(), gt_tools::Error> {
|
async fn main() -> Result<(), gt_tool::Error> {
|
||||||
let args = Args::parse();
|
let args = Args::parse();
|
||||||
|
|
||||||
let mut headers = reqwest::header::HeaderMap::new();
|
let mut headers = reqwest::header::HeaderMap::new();
|
||||||
@@ -27,14 +27,14 @@ async fn main() -> Result<(), gt_tools::Error> {
|
|||||||
.build()?;
|
.build()?;
|
||||||
|
|
||||||
match args.command {
|
match args.command {
|
||||||
gt_tools::cli::Commands::ListReleases => {
|
gt_tool::cli::Commands::ListReleases => {
|
||||||
let releases =
|
let releases =
|
||||||
gt_tools::api::release::list_releases(&client, &args.gitea_url, &args.repo).await?;
|
gt_tool::api::release::list_releases(&client, &args.gitea_url, &args.repo).await?;
|
||||||
for release in releases {
|
for release in releases {
|
||||||
println!("{:?}", release);
|
println!("{:?}", release);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gt_tools::cli::Commands::CreateRelease {
|
gt_tool::cli::Commands::CreateRelease {
|
||||||
name,
|
name,
|
||||||
body,
|
body,
|
||||||
draft,
|
draft,
|
||||||
@@ -49,7 +49,7 @@ async fn main() -> Result<(), gt_tools::Error> {
|
|||||||
tag_name,
|
tag_name,
|
||||||
target_commitish,
|
target_commitish,
|
||||||
};
|
};
|
||||||
gt_tools::api::release::create_release(
|
gt_tool::api::release::create_release(
|
||||||
&client,
|
&client,
|
||||||
&args.gitea_url,
|
&args.gitea_url,
|
||||||
&args.repo,
|
&args.repo,
|
||||||
@@ -57,7 +57,7 @@ async fn main() -> Result<(), gt_tools::Error> {
|
|||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
gt_tools::cli::Commands::UploadRelease {
|
gt_tool::cli::Commands::UploadRelease {
|
||||||
tag_name,
|
tag_name,
|
||||||
// create,
|
// create,
|
||||||
files,
|
files,
|
||||||
@@ -75,10 +75,10 @@ async fn main() -> Result<(), gt_tools::Error> {
|
|||||||
// Grab all, find the one that matches the input tag.
|
// Grab all, find the one that matches the input tag.
|
||||||
// Scream if there are multiple matches.
|
// Scream if there are multiple matches.
|
||||||
let release_candidates =
|
let release_candidates =
|
||||||
gt_tools::api::release::list_releases(&client, &args.gitea_url, &args.repo).await?;
|
gt_tool::api::release::list_releases(&client, &args.gitea_url, &args.repo).await?;
|
||||||
|
|
||||||
if let Some(release) = match_release_by_tag(&tag_name, release_candidates) {
|
if let Some(release) = match_release_by_tag(&tag_name, release_candidates) {
|
||||||
gt_tools::api::release_attachment::create_release_attachment(
|
gt_tool::api::release_attachment::create_release_attachment(
|
||||||
&client,
|
&client,
|
||||||
&args.gitea_url,
|
&args.gitea_url,
|
||||||
&args.repo,
|
&args.repo,
|
||||||
@@ -88,7 +88,7 @@ async fn main() -> Result<(), gt_tools::Error> {
|
|||||||
.await?;
|
.await?;
|
||||||
} else {
|
} else {
|
||||||
println!("ERR: Couldn't find a release matching the tag \"{tag_name}\".");
|
println!("ERR: Couldn't find a release matching the tag \"{tag_name}\".");
|
||||||
return Err(gt_tools::Error::NoSuchRelease);
|
return Err(gt_tool::Error::NoSuchRelease);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user