The API token is read from the environment variable `RELEASE_KEY_GITEA`. "GITEA" is on the end because Gitea itself will refuse to allow users to configure Act variables starting with the name "GITEA_". All information about the release is hard-coded right now. I just needed to see it hit the API and appear on the Gitea page. Hooking up the extra options is up next.
61 lines
1.2 KiB
Rust
61 lines
1.2 KiB
Rust
use serde::{Deserialize, Serialize};
|
|
|
|
pub mod cli;
|
|
|
|
pub fn module_echo() {
|
|
println!("hello from lib.rs!");
|
|
}
|
|
|
|
/// A struct matching a Gitea "Release" entry
|
|
#[derive(Deserialize, Debug)]
|
|
pub struct ReleaseInfo {
|
|
id: usize,
|
|
tag_name: String,
|
|
target_commitish: String,
|
|
name: String,
|
|
body: String,
|
|
url: String,
|
|
html_url: String,
|
|
tarball_url: String,
|
|
zipball_url: String,
|
|
upload_url: String,
|
|
draft: bool,
|
|
prerelease: bool,
|
|
created_at: String,
|
|
published_at: String,
|
|
author: Author,
|
|
}
|
|
|
|
#[derive(Deserialize, Debug)]
|
|
pub struct Author {
|
|
id: usize,
|
|
login: String,
|
|
login_name: String,
|
|
source_id: usize,
|
|
full_name: String,
|
|
email: String,
|
|
}
|
|
|
|
#[derive(Serialize, Debug)]
|
|
pub struct CreateReleaseOption {
|
|
body: String,
|
|
draft: bool,
|
|
name: String,
|
|
prerelease: bool,
|
|
tag_name: String,
|
|
target_commitish: String,
|
|
}
|
|
|
|
impl CreateReleaseOption {
|
|
pub fn new(name: String) -> Self {
|
|
Self{
|
|
body: String::from("hard-coded test body"),
|
|
draft: true,
|
|
name,
|
|
prerelease: true,
|
|
tag_name: String::from("hard-coded-test"),
|
|
target_commitish: String::from("3171c892480c46976106fa465d04fdb7e734dd53")
|
|
}
|
|
}
|
|
}
|