mirror of
https://github.com/jdx/mise-action.git
synced 2026-05-16 14:40:33 +00:00
chore: fix release-plz
This commit is contained in:
parent
96680f666f
commit
3600b64107
2 changed files with 78 additions and 59 deletions
|
|
@ -2,7 +2,19 @@
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
set -euxo pipefail
|
set -euxo pipefail
|
||||||
|
|
||||||
# Get the latest released version
|
# Get the current package.json version before any modifications
|
||||||
|
cur_pkg_version="$(jq -r .version package.json)"
|
||||||
|
|
||||||
|
# Get the latest GitHub release version
|
||||||
|
latest_release="$(gh release view --json tagName --jq .tagName 2>/dev/null || echo "")"
|
||||||
|
latest_release_version="${latest_release#v}"
|
||||||
|
|
||||||
|
# Check if package.json version is newer than the latest release
|
||||||
|
if [ -n "$latest_release_version" ] && [ "$cur_pkg_version" = "$latest_release_version" ]; then
|
||||||
|
echo "Package version $cur_pkg_version matches latest release $latest_release. Nothing to release."
|
||||||
|
# Still check if we need to create a new PR for unreleased changes
|
||||||
|
|
||||||
|
# Get the latest released version tag
|
||||||
latest_tag="$(git tag --list | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+(-rc\.[0-9]+)?$' | sort -V | tail -1)"
|
latest_tag="$(git tag --list | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+(-rc\.[0-9]+)?$' | sort -V | tail -1)"
|
||||||
|
|
||||||
# Check if there are commits since the last release
|
# Check if there are commits since the last release
|
||||||
|
|
@ -35,9 +47,7 @@ fi
|
||||||
git config user.name mise-en-dev
|
git config user.name mise-en-dev
|
||||||
git config user.email 123107610+mise-en-dev@users.noreply.github.com
|
git config user.email 123107610+mise-en-dev@users.noreply.github.com
|
||||||
|
|
||||||
# Update package.json version
|
# Create a PR with the version bump
|
||||||
cur_pkg_version="$(jq -r .version package.json)"
|
|
||||||
if [ "$cur_pkg_version" != "${version#v}" ]; then
|
|
||||||
npm version "${version#v}" --no-git-tag-version
|
npm version "${version#v}" --no-git-tag-version
|
||||||
|
|
||||||
git add package.json package-lock.json
|
git add package.json package-lock.json
|
||||||
|
|
@ -57,7 +67,16 @@ if [ "$cur_pkg_version" != "${version#v}" ]; then
|
||||||
gh pr edit --title "chore: release $version" --body "$changelog"
|
gh pr edit --title "chore: release $version" --body "$changelog"
|
||||||
echo "Updated existing release PR"
|
echo "Updated existing release PR"
|
||||||
fi
|
fi
|
||||||
else
|
elif [ -n "$cur_pkg_version" ] && [ "$cur_pkg_version" != "$latest_release_version" ]; then
|
||||||
echo "Package.json already at version ${version#v}, running postversion"
|
# Package version is different from latest release, so cut a release
|
||||||
|
echo "Package version v$cur_pkg_version is newer than latest release $latest_release. Creating release."
|
||||||
|
|
||||||
|
# Configure git for automated commits
|
||||||
|
git config user.name mise-en-dev
|
||||||
|
git config user.email 123107610+mise-en-dev@users.noreply.github.com
|
||||||
|
|
||||||
./scripts/postversion.sh
|
./scripts/postversion.sh
|
||||||
|
else
|
||||||
|
echo "Could not determine release status"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue