Skip to content

Commit df09812

Browse files
committed
CI: Respect the version bump requested in the action run
1 parent f94c347 commit df09812

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

.github/workflows/release.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,35 @@ jobs:
4242
git config --global user.email "github-actions[bot]@users.noreply.github.com"
4343
git config --global user.name "github-actions[bot]"
4444
45+
- name: Set up Node.js
46+
uses: actions/setup-node@v4
47+
with:
48+
node-version: '22'
49+
50+
- name: Determine next version
51+
id: semver
52+
run: |
53+
last="$(git describe --tags --abbrev=0 --match 'v[0-9]*' || echo 'v0.1.0')"
54+
bump="${{ github.event.inputs.bump }}"
55+
case "$bump" in
56+
patch|minor|major) inc="$bump" ;;
57+
*) echo "Invalid bump: $bump" ; exit 1 ;;
58+
esac
59+
new="$(npx -y semver -i "$inc" "$last")"
60+
new="${new#v}"
61+
echo "new_version=$new" >> "$GITHUB_OUTPUT"
62+
63+
- name: Prepare VERSION file
64+
run: |
65+
echo "${{ steps.semver.outputs.new_version }}" > VERSION
66+
git add VERSION
67+
git commit -m "chore(release): record version v${{ steps.semver.outputs.new_version }}"
68+
4569
- name: Run MonorepoBuilder release
4670
env:
4771
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4872
run: |
49-
$(composer global config bin-dir --absolute)/monorepo-builder release ${{ github.event.inputs.bump }}
73+
$(composer global config bin-dir --absolute)/monorepo-builder release v${{ steps.semver.outputs.new_version }}
5074
5175
- name: Ensure GitHub CLI and jq are installed
5276
run: |

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
## [Unreleased]
6+
7+
- Placeholder section for upcoming changes. Entries are appended automatically by the release workflow.
8+
9+

0 commit comments

Comments
 (0)