chore: update version and publish workflow - #10231
Conversation
| 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 |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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": { |
There was a problem hiding this comment.
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
| /nbproject/private/ | ||
| tsdoc-metadata.json | ||
| .vscode | ||
| CHANGELOG.md |
There was a problem hiding this comment.
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.
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.