diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 465ef7a46..db32df10d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -122,6 +122,7 @@ jobs: with: name: prebuilt-ubuntu path: crates/zng-view-prebuilt/lib/libzng_view.so + prebuild-windows: runs-on: windows-latest needs: [check-windows] @@ -225,6 +226,11 @@ jobs: needs: [check-ubuntu] steps: - uses: actions/checkout@v4 + - run: cargo do latest_release_changes release-changes.md + - uses: actions/upload-artifact@v4 + with: + name: release-changes.md + path: release-changes.md - run: cargo do doc - uses: actions/upload-artifact@v4 with: @@ -355,6 +361,9 @@ jobs: permissions: contents: write steps: + - uses: actions/download-artifact@v4 + with: + name: release-changes.md - uses: actions/download-artifact@v4 with: name: prebuilt-ubuntu @@ -379,6 +388,7 @@ jobs: with: tag: ${{ needs.tag.outputs.tag_name }} artifacts: "prebuilt/*" + bodyFile: release-changes.md publish-doc: runs-on: ubuntu-latest @@ -424,4 +434,5 @@ jobs: name: | prebuilt-* doc + release-changes.md failOnError: false \ No newline at end of file diff --git a/tools/do-tasks/src/main.rs b/tools/do-tasks/src/main.rs index 7f50c0a76..fc8d16838 100644 --- a/tools/do-tasks/src/main.rs +++ b/tools/do-tasks/src/main.rs @@ -26,6 +26,7 @@ fn main() { "semver_check" => semver_check(args), "publish_version_tag" => publish_version_tag(args), "comment_feature" => comment_feature(args), + "latest_release_changes" => latest_release_changes(args), "version" => version(args), "ls" => ls(args), "help" | "--help" => help(args), @@ -1250,6 +1251,37 @@ fn comment_feature(mut args: Vec<&str>) { } } +// used by `workflows/release.yml` +fn latest_release_changes(args: Vec<&str>) { + let changelog = match std::fs::read_to_string("CHANGELOG.md") { + Ok(c) => c, + Err(e) => fatal(f!("failed to read CHANGELOG.md, {e}")), + }; + + let mut changes = String::new(); + let mut started = false; + for line in changelog.lines().skip(1) { + if line.starts_with("# ") { + if started { + break; + } + started = true; + } else if started { + changes.push_str(line); + changes.push('\n'); + } + } + let changes = changes.trim(); + + if let Some(out) = args.first() { + if let Err(e) = std::fs::write(out, changes.as_bytes()) { + fatal(f!("failed to write changes, {e}")); + } + } else { + println(changes) + } +} + // do version // Prints version of Rust and components. // USAGE: