0

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?
baruchiro
  • 5,088
  • 5
  • 44
  • 66

1 Answers1

1

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
Nirgn
  • 1,879
  • 4
  • 23
  • 28