git-proxy icon indicating copy to clipboard operation
git-proxy copied to clipboard

Automatically increment version in `package.json` on new release 📦

Open JamieSlome opened this issue 1 year ago • 7 comments

Due to the fabulous @eddie-knight, GitProxy now has auto releases 💪 As part of #532, generally, all pull requests merged into main will result in a new release to GitHub Releases and NPM.

To ensure consistency across the codebase, GitHub Releases and NPM versions, we should ensure that the root package.json reflects the latest auto release version.

### Tasks
- [ ] Automatically update the `package.json` and `package-lock.json` to reflect the latest auto generated semver number
- [ ] For bonus points ⚡ update the `docusaurus.config.js` `version` with the latest auto generated semver number

JamieSlome avatar May 10 '24 15:05 JamieSlome

@eddie-knight - interested in taking this one and polishing off your Mona Lisa of contributions?

JamieSlome avatar May 10 '24 16:05 JamieSlome

@JamieSlome spitballing here... what about adding something like this?

      - run: npm ci
      - name: Update package.json version
        id: update_version
        run: |
          version="${{ steps.release-drafter.outputs.tag_name }}"
          jq --arg version "$version" '.version = $version' package.json > package_tmp.json
          mv package_tmp.json package.json

Note that the version number in the git repo will no longer be managed.

The only alternative I can think of would be to shift to another action like semantic-release. It seems to automatically bump the npm version number, but also doesn't update it in the git repo.

eddie-knight avatar May 16 '24 14:05 eddie-knight

Hmm, it seems that the guidance you've attached from semantic-release doesn't recommend updating the version in the repository as it can complicate the pipeline even more.

Semantic release themselves don't even update the version property in their package.json 🤔 Perhaps we just leave it and ignore the version number moving forward?

JamieSlome avatar May 16 '24 14:05 JamieSlome

Semantic release themselves don't even update the version property in their package.json 🤔 Perhaps we just leave it and ignore the version number moving forward?

I think we still need something to update the version number before publishing to npm, right?

eddie-knight avatar May 16 '24 14:05 eddie-knight

@eddie-knight - yes, we should make sure that the package.json value is actually updated in the release, and just permanently set our version to 0.0.0-development as instructed in the documentation site attached. I wonder if release-drafter already does this? If not, we should probably pivot to semantic-release and take advantage of the package.json bump for both GitHub Release and NPM. Means we can continue to use the commit titles as a standard for defining our release and bump type.

JamieSlome avatar May 16 '24 15:05 JamieSlome

@tt-gideonaryeetey and @divinetettey - asked discussed, are you interested in picking this issue up? Let me know below and then I can assign to you if you're happy to 👍

JamieSlome avatar May 21 '24 14:05 JamieSlome

Hi @JamieSlome yes I would be picking up this issue

divinetettey avatar May 22 '24 10:05 divinetettey