release-please-action icon indicating copy to clipboard operation
release-please-action copied to clipboard

Initial version 0.1.0 is ignored

Open maprokes opened this issue 2 years ago • 6 comments

TL;DR

When I use the manifest to set the initial version to 0.1.0 it is ignored when a new PR is created even though I have bump-minor-pre-major: true and bump-patch-for-minor-pre-major: true

Expected behavior

Expected next version is v0.1.1

Observed behavior

Next version in the PR is v1.0.0

Action YAML

name: Release
on:
    push:
        branches:
            - master

jobs:
    release-please:
        name: Prepare Release notes
        runs-on: ubuntu-latest
        outputs:
            released: ${{ steps.release-please.outputs.release_created }}
            tag: ${{ steps.release-please.outputs.tag_name }}
        steps:
            - id: release-please
              uses: GoogleCloudPlatform/release-please-action@v3
              with:
          # A repository with a version.txt and a CHANGELOG.md
                  changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"chore","section":"Miscellaneous","hidden":false}]'
                  release-type: simple
                  package-name: package1
                  bump-minor-pre-major: true
                  bump-patch-for-minor-pre-major: true

Log output

Run GoogleCloudPlatform/release-please-action@v3
  with:
    changelog-types: [{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"chore","section":"Miscellaneous","hidden":false}]
    release-type: simple
    package-name: package1
    bump-minor-pre-major: true
    bump-patch-for-minor-pre-major: true
    config-file: release-please-config.json
    manifest-file: .release-please-manifest.json
    token: ***
    fork: false
    clean: true
    monorepo-tags: false
    draft: false
    draft-pull-request: false
✔ Looking for latest release on branch: master with prefix: 
⚠ Could not find releases.
✔ Building releases
✔ Building strategies by path

✔ Looking for latest release on branch: master with prefix: 
⚠ Could not find releases.
✔ Building pull requests
✔ Building strategies by path
✔ Collecting release commit SHAs
⚠ Could not find releases.
⚠ Expected 1 releases, only found 0
✔ Collecting commits since all latest releases
✔ Splitting 20 commits by path
✔ Building candidate release pull request for path: .
⚠ No latest release pull request found.
✔ Considering: 14 commits
✔ Looking for open release pull requests
✔ found 0 open release pull requests.
⚠ file version.txt did not exist
✔ Starting GitHub PR workflow...
✔ Successfully found branch HEAD sha "12345678".
✔ Successfully created branch at https://api.github.com/repos/test-repo/git/refs/heads/release-please--branches--master
✔ Got the latest commit tree
✔ Successfully created a tree with the desired changes with SHA ---
✔ Successfully created commit. See commit at https://api.github.com/repos/org/test-repo/git/commits/12345678
✔ Successfully updated reference release-please--branches--master to 12345678
✔ Successfully opened pull request available at url: https://api.github.com/repos/org/test-repo/pulls/30.
✔ Successfully opened pull request: 30.
✔ Successfully added labels autorelease: pending to issue: 30

Additional information

When I installed the release-please locally and run it with same values, it created the expected version:

release-please --version
13.4.4
release-please release-pr --token=$PAT_TOKEN --repo-url=org/test-repo

.release-please-manifest.json

{
  ".": "0.1.0"
}

release-please-config.json

{
  "release-type": "simple",
  "bump-minor-pre-major": true,
  "bump-patch-for-minor-pre-major": true,
  "changelog-sections": [
    {
      "type": "feat",
      "section": "Features",
      "hidden": false
    },
    {
      "type": "fix",
      "section": "Bug Fixes",
      "hidden": false
    },
    {
      "type": "chore",
      "section": "Miscellaneous",
      "hidden": false
    }
  ],
  "packages": {
    ".": {
      "packageName": "test-repo",
      "draft": false,
      "prerelease": false,
      "bumpMinorPreMajor": true,
      "bumpPatchForMinorPreMajor": true,
      "changelogPath": "CHANGELOG.md",
      "versioning": "default"
    }
  }
}

maprokes avatar Jan 27 '22 10:01 maprokes

I'm currently also running into the same issue and have not found a way to work around it.

oatovar avatar Mar 03 '22 01:03 oatovar

@oatovar @maprokes I believe this may have been fixed by:

https://github.com/googleapis/release-please/pull/1267

Are you still bumping into issues?

bcoe avatar Mar 20 '22 14:03 bcoe

I didn't have a chance to re-test yet, will come back here, once I give it a try. Thanks!

maprokes avatar Mar 20 '22 19:03 maprokes

Yes, I tested that this is ocurring on the latest version for me but will only do so if I set the starting version to 0.0.0. If I bump this up to 0.0.1 it will work as intended.

oatovar avatar Mar 20 '22 22:03 oatovar

I found a work around for this, since we're using Backstage to scaffold microservice repos. We're using release-type: simple:

  1. Create the repo with version.txt containing 0.0.0.
  2. Cancel the current workflow that was kicked off by the initial push.
  • This is because by time the tag is pushed, release please could have already created the PR with v1.0.0.
  1. Run git push origin :release-please--branches--main to remove, and close, the open PR.
  2. Bump version.txt to 0.0.1 locally.
  3. Create a chore: bump initial release version commit.
  4. Tag this with v0.0.1.
  5. Push the commit and tag.

This will create a release that is v0.0.2, but that is better than going right to v1.0.0.

ellisio avatar Jul 28 '22 16:07 ellisio

I observe the same behavior as OP but where I have only set bump-minor-pre-major to true, while leaving bump-patch-for-minor-pre-major to its default value of false.

Only workaround I know to work is adding Release-As: 0.1.0 in commit message.

jacobsvante avatar Aug 12 '22 07:08 jacobsvante