chore: get postversion to work

This commit is contained in:
jdx 2025-07-16 04:57:59 +00:00
parent bd8ba20c56
commit 954e13db3e
No known key found for this signature in database
GPG key ID: 584DADE86724B407
3 changed files with 7 additions and 16 deletions

View file

@ -30,4 +30,5 @@ jobs:
- uses: jdx/mise-action@v2
- run: mise run release-plz
env:
DRY_RUN: 0
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View file

@ -25,7 +25,6 @@
"package": "ncc build -s src/index.ts --license licenses.txt",
"package:watch": "npm run package -- --watch",
"version": "./scripts/version.sh",
"postversion": "./scripts/postversion.sh",
"prepare": "husky"
},
"license": "MIT",

View file

@ -7,36 +7,27 @@ cur_version="$(jq -r .version package.json)"
# Check if this version has already been released
released_versions="$(git tag --list | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+(-rc\.[0-9]+)?$')"
if echo "$released_versions" | grep -q "^v$cur_version$"; then
echo "Version $cur_version already released"
exit 0
if ! echo "$released_versions" | grep -q "^v$cur_version$"; then
git tag -d "v$cur_version"
node ./scripts/postversion.sh
fi
# Get the next version and changelog from git-cliff
version="$(git cliff --bumped-version)"
changelog="$(git cliff --bump --unreleased --strip all)"
if [ "${MISE_DRY_RUN:-}" == 1 ]; then
if [ "${DRY_RUN:-1}" == 1 ]; then
echo "version: $version"
echo "changelog: $changelog"
exit 0
fi
# Update changelog
git cliff --bump -o CHANGELOG.md
# Update package.json version
npm version "${version#v}" --no-git-tag
# Build the project
npm run all
# Configure git for automated commits
git config user.name mise-en-dev
git config user.email 123107610+mise-en-dev@users.noreply.github.com
# Add all changes
git add package.json package-lock.json CHANGELOG.md dist/
# Update package.json version
npm version "${version#v}" --no-git-tag-version
# Create release branch and commit
git checkout -B release