GithubHelp home page GithubHelp logo

martinbeentjes / npm-get-version-action Goto Github PK

View Code? Open in Web Editor NEW
144.0 144.0 37.0 16 KB

This Action scans for a package.json file and reads the version number from that.

License: MIT License

Dockerfile 33.94% Shell 66.06%

npm-get-version-action's Introduction

Hi there ๐Ÿ‘‹

๐Ÿ”ญ Iโ€™m currently working at JOIN Cycling as a Software Engineer all over our tech stack.

๐Ÿ’ฌ Ask me about new languages, innovative ideas and projects

๐Ÿ“ซ How to reach me: Twitter, LinkedIn

npm-get-version-action's People

Contributors

dfantonio avatar jan-tee avatar mackeee-orange avatar martinbeentjes avatar morlaxar avatar robbinjanssen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

npm-get-version-action's Issues

Usage Example

This looks like what I need, but I'm not sure how to use it. Could you give an example workflow file?

[Announcement] Branching

I have cause quite some issues around repositories by changing branch names and adding jq.

Both branches master and main now exist for a period before I completely switch to main.

Would you create a licence file?

Thanks for developing this useful action. I wonder whether you can upload a licence file so that I can use your action in my workflow.

Action does not fail if it can't find package.json

I just configured this action and accidentally put the wrong path in there, which meant that the action could not find my package.json file, which makes sense.

However, that did not fail the package-version step, so I was debugging far later in the chain and wondering why the value was not used correctly. It was only after a while that I happened to open the output and wanted to look at the value it returned when I saw the "cat: can't open 'Resources/package.json': No such file or directory" message.

Unless I'm missing something, I think it would make sense to return a fail if the file can't be found. Even if for some reason this is not the default behavior, it might be useful to have an option failOnFileError or something like that to achieve this behavior.

Failed to download action 404

I've followed exactly your README adding:

- name: get-npm-version
   uses: martinbeentjes/npm-get-version-action@v1

But:

image

Redundant quotes in result value.

After release v.1.2.0 result value contains extra quotes "".

::set-output name=current-version::"0.2.4"
##[debug]steps['package-version']['outputs']['current-version']='"0.2.4"'

Major release tags suggestion

Hi! Thanks for the action! I have a suggestion to add a broader tag to the action release cycle, which would allow having less strict minor and patch versions dependency declaration like this:

uses: martinbeentjes/npm-get-version-action@v1

Though the main catch is not to forget to move it further on every release :) Would it be possible?

annotate in description the need for a checkout repository step

It definitely exposes me as a noob but I was sort of lost on this for a minute and I knew it was me because the current docs are really straight forward.

Maybe it would be good for other noobs like me to add that we need to checkout repository step in our flows.

steps:
      - name: Checkout Repository
        uses: actions/checkout@v2
      - name: get-npm-version
        id: package-version
        uses: martinbeentjes/[email protected]

Unable to resolve action

After the new release, the github action can't resolve the package:

Unable to resolve action `martinbeentjes/npm-get-version-action@master`, unable to find version `master`

`jq: not found`

I've started using npm-get-version-action in one of my workflows yesterday. Today, I noticed that some changes in the entrypoint.sh were made and I'm not totally sure if my workflow is still not configured well or wether this change resulted in action no longer working properly. Anways, this is what I see in the logs of my workflow:

/entrypoint.sh: line 4: jq: not found

This is how I use the action (echo in the logs shows nothing):

- name: get-current-version
  id: current-version
  uses: martinbeentjes/npm-get-version-action@master

- name: logs
  run: |
      echo ${{ steps.current-version.outputs.current-version }}

Detection of version isn't specific to the version field

When the package.json file has the word version in it in other fields, such as in the description, and the field occurs before the version field in the file, then the value of that field is used as the version. The workaround is to move the description or other offending fields below the version field in the file.

It would be helpful to use jq or something to more accurately parse the file and return the version without using grep.

Here's an example package.json that fails to detect the version properly https://github.com/getporter/vscode-extension/blob/15d7976fae18495f87fbad3b0f10113e11dfe5b2/package.json

Branch was renamed but not in the documentation

Hello,

The documentation is still referencing the master version, when the branch actually has been renamed to main. This branch renaming broke the users' workflow, so personally, I recommend you reference a tagged version in the documentation instead of a branch name.

Thanks.

Problems with path

I'm not sure if i'm doing something wrong but i keep getting

"cat: can't open './package.json': No such file or directory", although i have one in the root of the project. Could you point me in the right direction ?

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.