diff --git a/README.md b/README.md index 9860b54..befc544 100644 --- a/README.md +++ b/README.md @@ -8,12 +8,16 @@ This is an export of [`rustdoc-json-types`](https://github.com/rust-lang/rust/bl 1. Run `./update.sh` to pull code from upstream 2. Run `cargo test` -3. Update `version` field in `Cargo.toml` -4. `git add` and `git commit` changed files -5. `git tag vMAJOR.MINOR.PATCH` -6. `git push --tags` -7. `git push` +3. Run `./clgen.sh ` +4. Edit the `TODO` section in `CHANGELOG.md` to include what was done in this release. +5. `git add .` +6. `git commit -m ` 7. `cargo publish` +8. `git tag ` +9. `git push` +10. `git push --tags` + + ## License diff --git a/clgen.sh b/clgen.sh index faf08ab..e23fac0 100755 --- a/clgen.sh +++ b/clgen.sh @@ -14,28 +14,42 @@ grepor() { grep $1 || true } -for version_tag in $(git tag --sort=-version:refname); do - date=$(git show -s $version_tag --format=%ci | sd "[0-9]{2}:[0-9]{2}:[0-9]{2} \+[0-9]{4}" "") - format_version=$(git show $version_tag:src/lib.rs | grepor FORMAT_VERSION | col6 | sd ";" "") - - if [[ $version_tag == "v0.1.0" ]]; then - prev_tag="" - rustc_commit=7dc1e852d43cb8c9e77dc1e53014f0eb85d2ebfb - else - prev_tag=$(git tag --sort=-version:refname | grep -A 1 $version_tag | tail -n 1) - rustc_commit=$(git show $version_tag:COMMIT.txt) - fi - - # Handle pre https://github.com/rust-lang/rust/pull/89906 - if [[ -z $format_version ]]; then - format_version=$(curl -L# https://raw.githubusercontent.com/rust-lang/rust/$rustc_commit/src/librustdoc/json/mod.rs | grep format_version | col2 | sd "," "") - fi - - echo "" - echo "# [$version_tag](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/$version_tag) - $date" - echo "- Format Version: $format_version" - echo "- Upstream Commit: [\`$rustc_commit\`](https://github.com/rust-lang/rust/commit/$rustc_commit)" - echo "- Diff: [$version_tag...$prev_tag](https://github.com/aDotInTheVoid/rustdoc-types/compare/$prev_tag...$version_tag)" - - echo "" -done \ No newline at end of file +# Check we have two arguments, and assign them to variables + +if [[ $# -ne 2 ]]; then + echo "Usage: $0 " + exit 1 +fi + +old_version=$1 +new_version=$2 + +# Update the version in Cargo.toml +cat Cargo.toml | sd "version = \"$old_version\"" "version = \"$new_version\"" > tmp +# Error if the version is not updated +if [[ $(cat tmp | grep $new_version | wc -l) -ne 1 ]]; then + echo "Error: Version not updated in Cargo.toml" + exit 1 +fi +mv tmp Cargo.toml + +date=$(date --utc --rfc-3339=date) +format_version=$(cat src/lib.rs | grepor FORMAT_VERSION | col6 | sd ";" "") +rustc_commit=$(cat COMMIT.txt) + +# We do a shuffling dance to append the new version to the top of the changelog +cat< tmp +" +# [$new_version](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/$new_version) - $date" + +TODO: Changelog. + +- Format Version: $format_version" +- Upstream Commit: [\`$rustc_commit\`](https://github.com/rust-lang/rust/commit/$rustc_commit)" +- Diff: [$new_version...$new_version](https://github.com/aDotInTheVoid/rustdoc-types/compare/$old_version...$new_version)" +EOF + +cat tmp CHANGELOG.md > tmp2 +mv tmp2 CHANGELOG.md +rm tmp +