From e94a14ea037873d1d3594b9bac125d57cbc60b90 Mon Sep 17 00:00:00 2001 From: Davlatjon Shavkatov Date: Fri, 2 Oct 2026 02:40:28 +0500 Subject: [PATCH] ci: open version bump PRs instead of pushing master directly --- .github/workflows/lint_release.yml | 20 ++++++++++++++++++++ package.json | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint_release.yml b/.github/workflows/lint_release.yml index e57b16a..de87b2a 100644 --- a/.github/workflows/lint_release.yml +++ b/.github/workflows/lint_release.yml @@ -17,6 +17,7 @@ jobs: permissions: id-token: write contents: write + pull-requests: write runs-on: ${{ matrix.os }} strategy: @@ -70,3 +71,22 @@ jobs: GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} run: bun run release-me + + - name: Open version bump PR + if: success() + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} + run: | + TAG=$(git describe --tags --abbrev=0) + VERSION="${TAG##*-v}" + BRANCH="chore/bump-version-${VERSION}" + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git checkout -b "$BRANCH" + (cd packages/swagger-parse && npm version "$VERSION" --no-git-tag-version --allow-same-version) + git add packages/swagger-parse/package.json + git diff --cached --quiet && echo "version already in sync" && exit 0 + git commit -m 'chore(addon-swagger-parse): update package.json version to v'"${VERSION}" + git push --force origin "$BRANCH" + gh pr create --title "chore(@nanoexpress/addon-swagger-parse): update package.json version to v${VERSION}" --body "Automated version bump following ${TAG}." || echo "PR already open" + gh pr merge --auto --squash "$BRANCH" || echo "auto-merge not enabled; merge the bump PR manually" diff --git a/package.json b/package.json index 5ebd090..dda1e54 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "prepublishOnly": "bun run lint && bun run build", "typecheck": "tsc --emitDeclarationOnly", "format": "biome check --write . && rumdl fmt .", - "release-me": "cd packages/swagger-parse && release-me -w --plugins=npm,npm-post,git,github-release" + "release-me": "cd packages/swagger-parse && release-me -w --plugins=npm,git,github-release" }, "dependencies": {}, "devDependencies": {