semantic-release Github multi-platform publish

308 Views Asked by At

I have an Electron app that I want to publish with semantic-release.

I need to create a matrix in Github Action to build the app on different platforms:

strategy:
  matrix:
    os: [windows-latest, ubuntu-latest, macos-latest]

Now, if I run semantic-release before the build, it creates a Release in Github, and the build can't update an existing Release.

If I want to run semantic-release after the build,

  1. I don't know the new version for the build, and I don't know if I need to run the build anyway.
  2. How can I publish the build artifacts with semantic-release?
1

There are 1 best solutions below

0
Nirgn On

You can run semantic-release in dry mode (--dry-run) and it'll not create and publish a release. Then just get the next version number via grep.

export NEXT_VERSION=$(npx semantic-release --dry-run --branches main | grep -oE 'The next release version is [1234567890\.]+' | grep -oE '[1234567890\.]+')
echo $NEXT_VERSION