Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cryptically deleting the.version file #32

Open
sumanchapai opened this issue Feb 1, 2024 · 2 comments
Open

Cryptically deleting the.version file #32

sumanchapai opened this issue Feb 1, 2024 · 2 comments

Comments

@sumanchapai
Copy link

I spent many hours in the semantic-release repo figuring why the version file wouldn't be created only to find out that it does get created but gets deleted by this action. I am not exactly sure what the rationale was for deleting this file. Also, if this is something the user needs (as well as the changelog file if defined), don't we need to perform git add, git commit and git push so save these changes?

await fs.unlink(versionFilename)

@christophwitzko
Copy link
Member

christophwitzko commented Feb 1, 2024

Hi @sumanchapai, the idea when using the GitHub Action is that you don't have to deal with the .version file and rather use the outputs from the action itself (e.g., steps.semrel.outputs.version):

action/src/index.ts

Lines 102 to 108 in 1b14387

core.setOutput('changelog', generatedChangelog)
core.debug(`setting version to ${parsedVersion.version}`)
core.setOutput('version', parsedVersion.version)
core.setOutput('version_major', `${parsedVersion.major}`)
core.setOutput('version_minor', `${parsedVersion.minor}`)
core.setOutput('version_patch', `${parsedVersion.patch}`)
core.setOutput('version_prerelease', parsedVersion.prerelease.join('.'))

go-semantic-release does not push any files to your repository. To do that, you must use git add/commit in the workflow itself.

@sumanchapai
Copy link
Author

Thanks @christophwitzko. I had a use case where I needed to update the version file and only the create a build with the updated version file also push the version file to git. What I did was:

  1. Create a dry release
  2. Do nothing is no new release is to be created.
  3. If new release is to be created, write to version file. Perform git add/commit/push
  4. Create an actual release.

I did this in a fork of this repo: https://github.com/sumanchapai/go-semantic-release-action.
It feels like there should be a cleaner way to do this. But maybe not. Do you have suggestions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants