Skip to content
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

Merged
merged 4 commits into from
Apr 11, 2024
Merged

Conversation

jason-raitz
Copy link
Contributor

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

@@ -10,7 +10,7 @@ jobs:

steps:
- name: get env
run: echo $GITHUB
run: echo "${{ toJson(github) }}"
Copy link
Contributor Author

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?

Copy link
Contributor

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"

Copy link
Contributor Author

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.

Copy link
Contributor

@danschmidt5189 danschmidt5189 left a 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. :shipit:

@jason-raitz jason-raitz merged commit cc41016 into main Apr 11, 2024
8 checks passed
@jason-raitz jason-raitz deleted the fix-release-action branch April 11, 2024 20:55
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants