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

Writing new VERSION on MacOSX #22

Open
drbecavin opened this issue Jun 20, 2022 · 1 comment
Open

Writing new VERSION on MacOSX #22

drbecavin opened this issue Jun 20, 2022 · 1 comment
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@drbecavin
Copy link

Describe the bug
When I do
make relase
On my MacOSX. It cannot write properly VERSION file.
This is due to the read command which is not working as expected in zsh.

To Reproduce
Steps to reproduce the behavior:
Run make release on a zsh shell.

Expected behavior

@echo "WARNING: This operation will create s version tag and push to github"
@read -p "Version? (provide the next x.y.z semver) : " TAG
@echo "$${TAG}" > project_name/VERSION

The TAG variable will always be voiid and thus the VERSION file will be emplty. No release actions will be triggered in github.

Desktop (please complete the following information):

  • OS: [macOS 12.0.1]
  • Zsh [zsh 5.8 (x86_64-apple-darwin21.0)]

Additional context
For the moment I change by hand the version number in VERSION file.
And I changed Makefile with:
VERSION=$(shell cat checkatlas/VERSION)

@echo "Reading version $(VERSION) from: checkatlas/VERSION"
@$(ENV_PREFIX)gitchangelog > HISTORY.md
@git add checkatlas/VERSION HISTORY.md
@git commit -m "release: version $(VERSION) 🚀"
@drbecavin drbecavin added bug Something isn't working help wanted Extra attention is needed labels Jun 20, 2022
@mikeoertli
Copy link

I'll make a PR if I get a chance, but in the meantime, here is some info that might help. I believe the issue boils down to differences between bash and zsh. For zsh, the -p on a read command indicates that the value is to be read from a co-process, which is not the intended behavior here.

This worked for me with zsh on the CLI, I imagine it translates pretty literally to the Makefile:

read TAG\?"Version? (provide the next x.y.z semver) : " && echo "${TAG}"

It's worth finding a solution that works with either bash or zsh - I'm not sure if the above would satisfy that. One other option is to use echo to avoid differences in how read behaves. The -n means "don't print a newline after the message" and I believe it behaves the same way for bash and zsh, but haven't confirmed it.

For example:

echo -n "Version? (provide the next x.y.z semver) : "
read TAG
echo "${TAG}"

Maybe support for bash is less valuable since macOS switched the default shell to zsh in the last couple of years. 🤷‍♂️

Useful resources:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants