Skip to content

chore: update version and publish workflow - #10231

Open
lizschwab wants to merge 12 commits into
RaspberryPiFoundation:mainfrom
lizschwab:lerna-publish
Open

chore: update version and publish workflow#10231
lizschwab wants to merge 12 commits into
RaspberryPiFoundation:mainfrom
lizschwab:lerna-publish

Conversation

@lizschwab

Copy link
Copy Markdown
Contributor

The basics

The details

Resolves

Fixes #7765

Proposed Changes

Add Lerna to the monorepo and update the publish github action to use lerna for versioning and publishing.

Reason for Changes

This is part of the ongoing monorepo project. Leveraging Lerna sets us up to be able to build and publish packages in the correct order.

Test Coverage

No tests were added. I tested this locally by testing the version logic locally with the different variable combinations. Additional tests will be run prior to these changes being used for live publishing.

@lizschwab
lizschwab requested a review from maribethb August 5, 2026 16:49
@lizschwab
lizschwab requested a review from a team as a code owner August 5, 2026 16:49
@github-actions github-actions Bot added the PR: chore General chores (dependencies, typos, etc) label Aug 5, 2026
if [[ "${VERSION}" == *"-beta."* ]]; then
npm version prerelease --preid=beta --no-git-tag-version
VERSION_COMMAND="${VERSION_COMMAND} --conventional-commits --no-git-tag-version --yes"
if [ "${DRY_RUN}" = "true" ]; then

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a change from what I showed you the other day. I moved dry run into here so that we're using the same version command that would be applied with the same inputs.

DRY_RUN: ${{ inputs.dry_run}}
run: |
set -euo pipefail
VERSION_COMMAND="npx lerna version"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm essentially doing a string builder and adding the appropriate flags depending on the inputs and which branch we're working from.

if [ "${{ github.ref_name }}" != "${{ github.event.repository.default_branch }}" ]; then
echo "GitHub release would be created as prerelease."
if [ "${SKIP_VERSIONING}" = "true" ]; then
npx lerna publish from-package --yes --loglevel silly

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll remove the --loglevel silly once we're happy with the results

run: |
TARBALL="blockly-${{ needs.version.outputs.version }}.tgz"
VERSION=$(node -p "require('.packages/blockly/package.json').version")
TARBALL="blockly-*${VERSION}.tgz"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not 100% sure on this. I did a test of packing locally and all of the file names matched this pattern, so I think this will work.

"#core/*": "./build/src/core/*",
"#generators/*": "./build/src/generators/*"
},
"publishConfig": {

@lizschwab lizschwab Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the per-package configuration I was able to find for the publish command. https://github.com/lerna/lerna/blob/main/libs/commands/publish/README.md#per-package-configuration

Comment thread .gitignore
/nbproject/private/
tsdoc-metadata.json
.vscode
CHANGELOG.md

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can tell from the Lerna documentation, there's no per-package configuration for version. I'm hoping adding the root level and blockly package changelog files to gitignore will prevent them from being published.

@lizschwab
lizschwab marked this pull request as draft August 5, 2026 16:56
@lizschwab
lizschwab marked this pull request as ready for review August 5, 2026 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: chore General chores (dependencies, typos, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Configure the release process

2 participants