-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Use the tag name for the version in npm #10
Conversation
.github/workflows/build.yml
Outdated
@@ -10,7 +10,7 @@ jobs: | |||
|
|||
steps: | |||
- name: get env | |||
run: echo $GITHUB | |||
run: echo "${{ toJson(github) }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@danschmidt5189, this just prints out everything when the job runs. I don't think we really need jq to filter it. do we?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this looks good to me — no need for jq
.
Not sure if you saw this, but GitHub published documentation on printing debugging information and security hardening for Actions. In light of those, I'd like to see one change — introduce an intermediate environment variable instead of printing the result of that expression directly to the console, i.e.:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 I think your example is almost perfect. I think it just needed curly braces. added your suggested change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me following the change I requested.
Assuming that a releases tag name is the version, using github.ref_name should give the string for the tag to the command to publish the artifacts to npm.
See https://docs.github.com/en/actions/learn-github-actions/contexts#github-context:~:text=branch%2D1.-,github,-.ref_name