semantic-release-action
semantic-release-action copied to clipboard
Re-releasing the same version several times
Describe the bug A clear and concise description of what the bug is. After releasing several bug fixes, the CI and bot still seem to be releasing the same version (3 times) after it was already released and published.
Workflow If applicable, provide a workflow file to help explain your problem.
name: Semantic Release
on:
push:
branches: [master]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: '12.x'
- run: |
npm ci
npm run build
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Expected behaviour Seeing new versions being mentioned in the changelog, commits and tags.
Additional context Add any other context about the problem here. Cf. https://github.com/Berkmann18/json-fixer
Edit: And why is it not looking at the git tag or package.json#version
numbers? After doing a manual release, it still re-released the prior version again (https://github.com/Berkmann18/json-fixer/commit/30580b21f99449761e550710cca614e6af75bf87).
semantic-release uses Git tags to determine the commits added since the last release. If a release has been published before setting up semantic-release you must make sure the most recent commit included in the last published release is in the release branches history and is tagged with the version released, formatted according to the tag format configured (defaults to vx.y.z).
Unless I'm mistaken, the SR action doesn't seem to be looking at the git tag
even after having it pushed to master
and it even ignores more recent tags.
And it's not like I suddenly switched to using a semantic-release with semantic versions when that has been set since the start; I guess, switching from a TravisCI with SR to a GH Action approach with no version-changing commits caused the problem.
But at the same time, I've yet to find a successful way to fix that.
Very strangely, I checked your action log. It says "Found git tag v1.4.1 associated with version 1.4.1 on branch master". But your latest tag is v1.4.2 and the version on npm is 1.4.3.
The latest NPM version (1.4.3) reflects the one in the package.json (which normally should be updated by SR when needed), the v1.4.3
tag is on the master
branch so SR should be able to find this.
It's weird!
This problem seems to have gone away, I don't know SR CI managed to release a new (minor) version to GH and NPM without updating the package.json
file? I never thought this was possible.
I think I know where the problem is. You need to add the package.json
file to the @semantic-release/git
plugin. semantic-release
automatically updates the package.json
file before releasing it to npm, but does not commit this change to your branch.
Hmm, that could explain why although the latest GH release does contain the package.json which is out-of-sync.
I've noticed that according to https://github.com/semantic-release/git#examples, the @semantic-release/npm
should be before the git
as it's apparently where the package.json
is updated.