Add release changes to workflow.

This commit is contained in:
Samuel Guerra 2024-04-26 22:03:08 -03:00
parent d9c7357303
commit 8767d742e6
2 changed files with 43 additions and 0 deletions

View File

@ -122,6 +122,7 @@ jobs:
with: with:
name: prebuilt-ubuntu name: prebuilt-ubuntu
path: crates/zng-view-prebuilt/lib/libzng_view.so path: crates/zng-view-prebuilt/lib/libzng_view.so
prebuild-windows: prebuild-windows:
runs-on: windows-latest runs-on: windows-latest
needs: [check-windows] needs: [check-windows]
@ -225,6 +226,11 @@ jobs:
needs: [check-ubuntu] needs: [check-ubuntu]
steps: steps:
- uses: actions/checkout@v4 - 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 - run: cargo do doc
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
with: with:
@ -355,6 +361,9 @@ jobs:
permissions: permissions:
contents: write contents: write
steps: steps:
- uses: actions/download-artifact@v4
with:
name: release-changes.md
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
name: prebuilt-ubuntu name: prebuilt-ubuntu
@ -379,6 +388,7 @@ jobs:
with: with:
tag: ${{ needs.tag.outputs.tag_name }} tag: ${{ needs.tag.outputs.tag_name }}
artifacts: "prebuilt/*" artifacts: "prebuilt/*"
bodyFile: release-changes.md
publish-doc: publish-doc:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -424,4 +434,5 @@ jobs:
name: | name: |
prebuilt-* prebuilt-*
doc doc
release-changes.md
failOnError: false failOnError: false

View File

@ -26,6 +26,7 @@ fn main() {
"semver_check" => semver_check(args), "semver_check" => semver_check(args),
"publish_version_tag" => publish_version_tag(args), "publish_version_tag" => publish_version_tag(args),
"comment_feature" => comment_feature(args), "comment_feature" => comment_feature(args),
"latest_release_changes" => latest_release_changes(args),
"version" => version(args), "version" => version(args),
"ls" => ls(args), "ls" => ls(args),
"help" | "--help" => help(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 // do version
// Prints version of Rust and components. // Prints version of Rust and components.
// USAGE: // USAGE: