Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions .github/workflows/bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,16 @@ jobs:
fetch-depth: 0
fetch-tags: true

- uses: pnpm/action-setup@v4

- uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
cache: "npm"
cache-dependency-path: package-lock.json
cache: "pnpm"
cache-dependency-path: pnpm-lock.yaml

- name: Install dependencies
run: npm ci --ignore-scripts --prefer-offline --no-audit --no-fund
run: pnpm install --frozen-lockfile --ignore-scripts --prefer-offline

- name: Bump version
run: ${{ inputs.bump-command }}
Expand All @@ -68,11 +70,11 @@ jobs:
git config --local user.name "Version bumpooor"

# check if there are changes to commit
if [[ -z "$(git status --porcelain package.json package-lock.json **/package.json **/package-lock.json)" ]]; then
if [[ -z "$(git status --porcelain package.json pnpm-lock.yaml **/package.json **/pnpm-lock.yaml)" ]]; then
echo "No changes to commit. Failing bump job."
exit 1
fi

git add package.json package-lock.json $(git ls-files "**/package.json" "**/package-lock.json")
git add package.json pnpm-lock.yaml $(git ls-files "**/package.json" "**/pnpm-lock.yaml")
git commit -m "chore(release): v${{ steps.get-version.outputs.bumped_version }} [skip ci]"
git push origin ${{ inputs.ref }}
10 changes: 6 additions & 4 deletions .github/workflows/check-version-bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,22 @@ jobs:
fetch-depth: 0
fetch-tags: true

- uses: pnpm/action-setup@v4

- uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
cache: "npm"
cache-dependency-path: package-lock.json
cache: "pnpm"
cache-dependency-path: pnpm-lock.yaml

- name: Install dependencies
run: npm ci --ignore-scripts --prefer-offline --no-audit --no-fund
run: pnpm install --frozen-lockfile --ignore-scripts --prefer-offline

- id: check-bump
run: |
echo "Running bump command to check for version changes..."
BUMP=$(${{ inputs.bump-command }}) || true

if [ -n "$BUMP" ] && [[ "$BUMP" != *"No version bump needed"* ]]; then
echo "A version bump is needed: '$BUMP'"
echo "triggers_bump=true" >> $GITHUB_OUTPUT
Expand Down
24 changes: 11 additions & 13 deletions .github/workflows/determine-rc-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,17 @@ jobs:
fetch-depth: 0
fetch-tags: true

- uses: pnpm/action-setup@v4

- uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}

# Only install minimal dependencies needed for npm version commands
- name: Setup npm
run: npm install -g npm@latest

# Update package.json version locally (not committed)
# This is needed to determine the base version for the RC
- name: Ephemeral version bump
run: |
npm version "${{ inputs.bump-type }}" --no-git-tag-version
pnpm version "${{ inputs.bump-type }}" --no-git-tag-version --no-git-checks

# Determine RC version using npm's built-in prerelease functionality
- name: Determine RC version
Expand All @@ -52,22 +50,22 @@ jobs:
# Get the current base version after the bump
base_version="$(jq -r .version package.json)"
echo "Base version: $base_version"

# Check if there are existing RC versions for this base version
# Updated regex to match the new format with dot separator (e.g., 2.12.1-rc.0)
latest_rc=$(npm view "${{ inputs.package-name }}" versions --json 2>/dev/null | jq -r '.[]' 2>/dev/null | grep "^$base_version-rc\.[0-9]\+$" | sort -V | tail -n 1 || echo "")
latest_rc=$(pnpm view "${{ inputs.package-name }}" versions --json 2>/dev/null | jq -r '.[]' 2>/dev/null | grep "^$base_version-rc\.[0-9]\+$" | sort -V | tail -n 1 || echo "")
echo "Latest RC: $latest_rc"

if [ -z "$latest_rc" ]; then
# No existing RC for this base version - create the first one
npm version "$base_version-rc.0" --no-git-tag-version
pnpm version "$base_version-rc.0" --no-git-tag-version --no-git-checks
else
# Existing RC found - set the version to match it then increment
npm version "$latest_rc" --no-git-tag-version
npm version prerelease --preid=rc --no-git-tag-version
pnpm version "$latest_rc" --no-git-tag-version --no-git-checks
pnpm version prerelease --preid=rc --no-git-tag-version --no-git-checks
fi

rc_version="$(jq -r .version package.json)"

echo "RC version: $rc_version"
echo "value=$rc_version" >> $GITHUB_OUTPUT
8 changes: 5 additions & 3 deletions .github/workflows/open-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,13 @@ jobs:
run: |
git checkout -b ${{ inputs.branch-name }}

- uses: pnpm/action-setup@v4

- uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
cache: "npm"
cache-dependency-path: package-lock.json
cache: "pnpm"
cache-dependency-path: pnpm-lock.yaml

- name: Make changes
run: ${{ inputs.change-command }}
Expand Down Expand Up @@ -99,7 +101,7 @@ jobs:
base: '${{ inputs.base-branch }}',
body: '${{ inputs.pr-body }}'
});

console.log(`Pull request created: ${response.data.html_url}`);
} catch (error) {
core.setFailed(`Failed to create pull request: ${error.message}`);
Expand Down