From ab62791df914f290c711d273bf588f1bce3850b7 Mon Sep 17 00:00:00 2001 From: Esa-Matti Suuronen Date: Fri, 18 Nov 2022 14:12:56 +0200 Subject: [PATCH] Use @valu/npm-tools in release scripts --- prerelease.sh | 28 +------------ release.sh | 108 +------------------------------------------------- 2 files changed, 2 insertions(+), 134 deletions(-) diff --git a/prerelease.sh b/prerelease.sh index c0672ee..9c5b8d0 100755 --- a/prerelease.sh +++ b/prerelease.sh @@ -2,30 +2,4 @@ set -eu - -if [ "${1:-}" != "" ]; then - cd "packages/$1" -fi - -pkg="$(basename $(pwd))" - -if [ "$(git rev-parse --show-toplevel)" = "$(pwd)" ]; then - echo "prerelease.sh must be run from the packge dir" -fi - -if [ ! -f package.json ]; then - echo - echo "No package.json at $(pwd)" - echo - exit 1 -fi - - -if [ "$(git status . --porcelain)" != "" ]; then - echo - echo "Dirty git. Commit changes" - echo - exit 1 -fi - -git push -f origin HEAD:release/$pkg/prerelease \ No newline at end of file +exec "$(git rev-parse --show-toplevel)/packages/npm-tools/scripts/valu-npm-prerelease" \ No newline at end of file diff --git a/release.sh b/release.sh index 5b13ea1..f9d3a37 100755 --- a/release.sh +++ b/release.sh @@ -2,110 +2,4 @@ set -eu -changelog=true - -if [ "${1:-}" != "" ]; then - cd "packages/$1" -fi - -pkg="$(basename $(pwd))" - -if [ "$(git rev-parse --show-toplevel)" = "$(pwd)" ]; then - echo "release.sh must be run from the packge dir" -fi - -if [ ! -f package.json ]; then - echo - echo "No package.json at $(pwd)" - echo - exit 1 -fi - - -if [ "$(git rev-parse --abbrev-ref HEAD)" != "master" ]; then - echo - echo "Not on the master branch" - echo - exit 2 -fi - -if [ "$(git status . --porcelain)" != "" ]; then - echo - echo "Dirty git. Commit changes" - echo - exit 1 -fi - - -git fetch origin - -if [ "$(git rev-parse HEAD)" != "$(git rev-parse origin/master)" ]; then - echo - echo "Repository not up to date. Do your git push/pull/rebase dance" - echo - exit 1 -fi - -npm test - -current_version="$(jq -r .version package.json)" - -echo "Current version is: $current_version" - -read -p "New version> " new_version - -if [ "$new_version" = "" ]; then - echo "Bad version" - exit 1 -fi - -if $changelog; then - prev_tag="$(git describe --abbrev=0 --match "$pkg/v*" || true)" - - tmp_changelog=changelog_entry.md - - echo "## v$new_version" > "$tmp_changelog" - echo >> "$tmp_changelog" - date +'%Y-%m-%d' >> "$tmp_changelog" - echo >> "$tmp_changelog" - git log --format='- %s [%h](https://github.com/valu-digital/npm-packages/commit/%h) - %an' HEAD...$prev_tag . >> "$tmp_changelog" - echo >> "$tmp_changelog" - - if [ -f CHANGELOG.md ]; then - cat CHANGELOG.md >> $tmp_changelog - fi - - mv $tmp_changelog CHANGELOG.md - - while true; do - echo - echo - echo "----------------------------------------------------------------------" - git diff - echo "----------------------------------------------------------------------" - echo - echo - echo "👆 The CHANGELOG.md file was updated automatically." - echo - echo "Type 'e' to edit in vscode and 'c' to commit and continue" - read -p "> " changelog_mode - - if [ "$changelog_mode" = "e" ]; then - code CHANGELOG.md - fi - - if [ "$changelog_mode" = "c" ]; then - break - fi - done - - if [ "$(git status . --porcelain)" != "" ]; then - git add CHANGELOG.md - git commit -m "Update changelog for $pkg v$new_version" - git push origin master:master - fi -fi - - -git push origin master:master -git push -f origin master:release/$pkg/$new_version +exec "$(git rev-parse --show-toplevel)/packages/npm-tools/scripts/valu-npm-release" \ No newline at end of file