Skip to content

New flag - Commit all modified or deleted changes

I have been looking for a way to use yarn monorepos and still publish using CI. That last mile is the tricky bit and this package almost had it solved for me. So I set to accomodate my use case and hopefully be helpful for others.

My intention for CI pipelines is roughly this:

build/test/etc:
   ....

bump:
  stage: bump
  script:
    - yarn version check
    - yarn version apply --all
    - yarn push-to-repo -a -m "#publish monorepo packages"
  rules:
    - if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_REF_NAME == "master" && $CI_COMMIT_MESSAGE !~ /^#publish.*/

publish:
  stage: publish
  script:
    - yarn workspaces foreach npm publish
  rules:
    - if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_REF_NAME == "master" && $CI_COMMIT_MESSAGE =~ /^#publish.*/

So I had to make a solution for commiting multiple files. I added a new flag "-a" and it picks up dirty changes to existing files. I restricted it to modified and deleted changes.

I have tested it using a test-branch in my fork repository and it works fine.

This MR is backwards compatible except for the fact that I removed the required option on -f, so bumping to 0.3.0.

To progress with my monorepo project I will publish this to npm under another scope, but will remove it if you want this to go into your package.

Edited by Asbjørn Lucassen

Merge request reports

Loading