finos / git-proxy

Deploy custom push protections and policies on top of Git
https://git-proxy.finos.org
Apache License 2.0
102 stars 68 forks source link

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

Open JamieSlome opened 4 months ago

JamieSlome commented 4 months ago

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 commented 4 months ago

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

eddie-knight commented 4 months ago

@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.

JamieSlome commented 4 months ago

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?

eddie-knight commented 4 months ago

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?

JamieSlome commented 4 months ago

@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 commented 4 months ago

@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 👍

divinetettey commented 4 months ago

Hi @JamieSlome yes I would be picking up this issue