formatting, release

master
Ondřej Hruška 3 months ago
parent 01876c7487
commit ebd1ff8848
  1. 7
      CHANGELOG.md
  2. 65
      Cargo.lock
  3. 4
      Cargo.toml
  4. 7
      changelog/channels/default.json
  5. 4
      clpack.toml
  6. 7
      src/action_pack.rs
  7. 10
      src/assets/config_file_template.toml
  8. 3
      src/config.rs
  9. 15
      src/integrations/youtrack.rs
  10. 2
      src/main.rs

@ -1,5 +1,12 @@
# Changelog
## [1.1.0] - 2025-09-23
### New features
- Add integration to JetBrains YouTrack (#SW-4712)
- Add command line option `cl status` (#SW-4716)
- Change `cl pack` to show a preview of the rendered changelog before asking for version.
## [1.0.0] - 2025-09-15
- First stable release, file format version 1

65
Cargo.lock generated

@ -212,13 +212,14 @@ checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675"
[[package]]
name = "clpack"
version = "1.0.0"
version = "1.1.0"
dependencies = [
"anyhow",
"chrono",
"clap",
"colored",
"dotenv",
"env_logger",
"faccess",
"indexmap",
"inquire",
@ -362,6 +363,29 @@ dependencies = [
"cfg-if",
]
[[package]]
name = "env_filter"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "186e05a59d4c50738528153b83b0b0194d3a29507dfec16eccd4b342903397d0"
dependencies = [
"log",
"regex",
]
[[package]]
name = "env_logger"
version = "0.11.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f"
dependencies = [
"anstream",
"anstyle",
"env_filter",
"jiff",
"log",
]
[[package]]
name = "equivalent"
version = "1.0.2"
@ -865,6 +889,30 @@ version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
[[package]]
name = "jiff"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be1f93b8b1eb69c77f24bbb0afdf66f54b632ee39af40ca21c4365a1d7347e49"
dependencies = [
"jiff-static",
"log",
"portable-atomic",
"portable-atomic-util",
"serde",
]
[[package]]
name = "jiff-static"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03343451ff899767262ec32146f6d559dd759fdadf42ff0e227c7c48f72594b4"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "js-sys"
version = "0.3.78"
@ -1110,6 +1158,21 @@ version = "0.3.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c"
[[package]]
name = "portable-atomic"
version = "1.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483"
[[package]]
name = "portable-atomic-util"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507"
dependencies = [
"portable-atomic",
]
[[package]]
name = "potential_utf"
version = "0.1.3"

@ -1,6 +1,6 @@
[package]
name = "clpack"
version = "1.0.0"
version = "1.1.0"
edition = "2024"
authors = ["Ondřej Hruška <ondra@ondrovo.com>"]
description = "Manage changelog across multiple release channels"
@ -25,5 +25,7 @@ reqwest = { version = "0.12", features = ["rustls-tls", "blocking"] } #, optiona
json_dotpath = "1.1.0"
dotenv = "0.15.0"
env_logger = "0.11.8"
[dev-dependencies]
simple-logging = "2"

@ -4,5 +4,12 @@
"entries": [
"stable release"
]
},
{
"version": "1.1.0",
"entries": [
"SW-4712-clpack-youtrack-integration",
"SW-4716-add-cl-status"
]
}
]

@ -116,3 +116,7 @@ released_state = "Released"
# Change a custom version field of the released issues.
# Uncomment to enable, change to fit your project
version_field = "Available in version"
# If multiple logical projects are tracked in the same YouTrack project, versions may beed namespacing.
# This prefix is added to versions when creating them in YouTrack
version_prefix = "clpack-"

@ -1,12 +1,11 @@
use crate::AppContext;
use crate::config::{ChannelName, ENV_YOUTRACK_TOKEN, ENV_YOUTRACK_URL};
use crate::config::ChannelName;
use crate::git::{BranchName, get_branch_name};
use crate::integrations::youtrack::{
YouTrackClient, youtrack_integration_enabled, youtrack_integration_on_release,
youtrack_integration_enabled, youtrack_integration_on_release,
};
use crate::store::{Release, Store};
use crate::utils::empty_to_none::EmptyToNone;
use anyhow::{Context, bail};
use anyhow::bail;
use colored::Colorize;
pub fn pack_resolve_and_show_preview(

@ -78,8 +78,8 @@ branch_version_pattern = '/^rel\/([\d.]+)$/'
default = '/^(?:main|master)$/'
[integrations.youtrack]
# When creating a release, clpack can mark the included issues
# as "Released" and record the versions into YouTrack.
# When creating a release, clpack can mark the included issues as "Released" and record
# the versions into YouTrack.
#
# clpack will ask for confirmation before doing this.
#
@ -102,7 +102,7 @@ enabled = false
# YouTrack server URL. Can be changed locally by setting env var CLPACK_YOUTRACK_URL
url = "https://example.youtrack.cloud"
# Channels filter - release on those channels will trigger the YouTrack integration
# Channels filter - release on those channels will trigger the YouTrack integration
# (i.e. don't mark as Released if it's only in beta)
channels = [
"default"
@ -115,3 +115,7 @@ channels = [
# Change a custom version field of the released issues.
# Uncomment to enable, change to fit your project
#version_field = "Available in version"
# If multiple logical projects are tracked in the same YouTrack project, versions may beed namespacing.
# This prefix is added to versions as fetched/created in YouTrack
#version_prefix = ""

@ -145,4 +145,7 @@ pub struct YouTrackIntegrationConfig {
/// Name of the version field (Available in version)
pub version_field: Option<String>,
/// Version prefix
pub version_prefix: String,
}

@ -52,6 +52,9 @@ pub fn youtrack_integration_on_release(
let client = YouTrackClient::new(url, &token)?;
let mut project_id_opt = None;
let mut set_version_opt = None;
let prefixed_version = format!("{}{}", ytconf.version_prefix, release.version);
let date = chrono::Utc::now();
for entry in release.entries {
@ -77,11 +80,12 @@ pub fn youtrack_integration_on_release(
let project_id = project_id_opt.as_ref().unwrap(); // We know it is set now
let mut set_version_opt = None;
if let Some(field) = &ytconf.version_field {
if let Some(field) = &ytconf.version_field
&& set_version_opt.is_none()
{
let set_version = SetVersion {
field_name: field,
version: &release.version,
version: &prefixed_version,
};
client.ensure_version_exists_in_project(&project_id, &set_version, Some(date))?;
@ -281,7 +285,7 @@ impl YouTrackClient {
}
// Got something?
let Some((field_id, bundle_id)) = field_bundle else {
let Some((_field_id, bundle_id)) = field_bundle else {
bail!(
"YouTrack version field {field_name} not found in the project {project_id}",
field_name = version_info.field_name
@ -293,6 +297,7 @@ impl YouTrackClient {
#[derive(Deserialize)]
struct YTVersion {
name: VersionName,
#[allow(unused)]
id: String,
}
@ -335,6 +340,7 @@ impl YouTrackClient {
#[derive(Deserialize, Debug)]
#[allow(non_snake_case)]
#[allow(unused)]
struct CreateVersionResponse {
releaseDate: Option<i64>,
released: bool,
@ -457,6 +463,7 @@ mod tests {
use log::{LevelFilter, debug};
// #[test] // Disabled
#[allow(unused)]
fn test_youtrack_communication() {
simple_logging::log_to_stderr(LevelFilter::Debug);

@ -39,6 +39,8 @@ pub struct AppContext {
}
fn main() {
env_logger::init();
if let Err(e) = main_try() {
eprintln!("{}", format!("{:?}", e).red().bold());
exit(1);

Loading…
Cancel
Save