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

Bug report: publish next build breaks when the commit hash has a leading zero and consists of only numbers #4194

Closed
waldekmastykarz opened this issue Dec 3, 2022 · 1 comment
Assignees
Milestone

Comments

@waldekmastykarz
Copy link
Member

Description

The publish_next build breaks when the commit hash has a leading zero and consists of only numbers. The script responsible for extracting the commit hash and adding it to the package version, treats the hash as a number which leads to the leading 0 being removed. See example build at https://github.com/pnp/cli-microsoft365/actions/runs/3606017259/jobs/6079529925

Steps to reproduce

Very hard, because you need to have a short commit hash consisting of only numbers

Expected results

npm package published with the exact short commit hash

Actual results

npm package published the with the short commit hash with the leading 0 stripped

Diagnostics

No response

CLI for Microsoft 365 version

Latest from main

nodejs version

v16

Operating system (environment)

Linux

Shell

bash

cli doctor

No response

Additional Info

It seems like the issue is caused by the npm publish command that removes the leading 0 from the package version. It seems like we're stamping the correct version in the update-package-version.js script, but when we then move to npm publish, what's published is the version without the leading 0.

image

A workaround could be to check if the short commit hash starts with a 0 and if so, if it's a number, and if it is, add an additional letter.

@waldekmastykarz
Copy link
Member Author

Just to clarify, this isn't an issue with npm, which is following the semver spec:

image

So it's a problem with our script responsible for stamping the package version with the commit hash.

waldekmastykarz added a commit to waldekmastykarz/cli-microsoft365 that referenced this issue Dec 4, 2022
@milanholemans milanholemans added this to the v6.1 milestone Dec 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants