diff --git a/.github/workflows/release-plz.yml b/.github/workflows/release-plz.yml index ac8e722..f97c332 100644 --- a/.github/workflows/release-plz.yml +++ b/.github/workflows/release-plz.yml @@ -30,4 +30,5 @@ jobs: - uses: jdx/mise-action@v2 - run: mise run release-plz env: + DRY_RUN: 0 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/package.json b/package.json index fdbf0ba..054239e 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/scripts/release-plz.sh b/scripts/release-plz.sh index 5ffd417..523038c 100755 --- a/scripts/release-plz.sh +++ b/scripts/release-plz.sh @@ -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