pascalgn / npm-publish-action

GitHub action to automatically publish packages to npm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unexpected input(s) 'publish_command'

joaoschaab opened this issue · comments

Hi there!

I'm getting this warning when trying to use publish_command option. I don't know how github action works but giving a quick look I think the options publish_command and publish_args are not declared in action.yaml file.

Can anybody help me ? Thanks

Reading the source code, it seems like the script is now expecting PUBLISH_COMMAND as an env variable rather than an input

This is failing for me as well:

Unexpected input(s) 'publish_command', 'publish_args', valid inputs are ['entryPoint', 'args', 'commit_pattern', 'tag_name', 'tag_message', 'workspace']

@joaoschaab you know what to change the action to?

I tried modifying the yaml, it now passes, but I don't see my package so I guess it didn't work - there is no output for good or bad...

Wow, really sorry, this issue got totally lost, thanks for notifying me, @IdanAdar 👍

I've just released version 1.3.5 which should hopefully fix this issue! If there are any problems, please let me know 🙏

Thanks @pascalgn While the error is gone, unfortunately I cannot confirm it is working - I still don't see any package in npmjs.com, and the logs say nothing - not that it worked nor that it failed... everything supposedly "passed"...

In the package.json the version is 0.0.2. I also have a Release 0.0.2 with tag 0.0.2 in case it matters.
I open a PR titled "Release 0.0.2" but nothing is published... what am I missing here?

Edit 1:
I am not sure if maybe my workflows are conflicting?
https://github.com/IBM/secrets-manager-nodejs-sdk/tree/main/.github/workflows

The create-release workflow will generate a release when merging to main branch, and maybe npm-publish workflow also then tries the same?

Is npm-publish supposed to create a release+tag+changelog like create-release? Does it matter if it already took please? should I combine the two?

Edit 2:
I tried w/out create-release and it still didn't publish nor created a release/tag of its own like the docs say...

I think this is a different issue because in the repository you linked to, I don't see any matching commits.

As the README says

Now, when someone changes the version in package.json to 1.2.3 and pushes a commit with the message Release 1.2.3, the npm-publish action will create a new tag v1.2.3 and publish the package to the npm registry.

So unless there's a commit with the message Release 1.2.3, the npm-publish-action won't do anything

Maybe I am missing something obvious @pascalgn. Does this not qualify? IBM/secrets-manager-node-sdk@05074f0

I created a new branch called "Release 0.0.1", in it I changed the version to 0.0.1 and when committing it I described the commit as "Release 0.0.1" and I then merge it...

After comitting directly to main branch(!) it then worked, but failed with the following.
Also, shouldn't this work via a PR as well?

Run pascalgn/npm-publish-action@1.3.5
  with:
    tag_name: v%s
    tag_message: v%s
    commit_pattern: ^Release (\S+)
    workspace: .
    publish_command: yarn
    publish_args: --non-interactive
  env:
    GITHUB_TOKEN: ***
    NPM_AUTH_TOKEN: ***
/usr/bin/docker run --name e0a0be421e4d53aadb40f740a703c8_e87590 --label 179394 --workdir /github/workspace --rm -e GITHUB_TOKEN -e NPM_AUTH_TOKEN -e INPUT_TAG_NAME -e INPUT_TAG_MESSAGE -e INPUT_COMMIT_PATTERN -e INPUT_WORKSPACE -e INPUT_PUBLISH_COMMAND -e INPUT_PUBLISH_ARGS -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/secrets-manager-nodejs-sdk/secrets-manager-nodejs-sdk":"/github/workspace" 179394:21e0a0be421e4d53aadb40f740a703c8
Found commit: Release 0.0.1
Executing: git rev-parse -q --verify refs/tags/v0.0.1
Executing: git config user.name IBM
Executing: git config user.email 
Executing: git tag -a -m v0.0.1 v0.0.1
Executing: git push origin refs/tags/v0.0.1
Tag has been created successfully: v0.0.1
Executing: yarn publish --non-interactive --new-version 0.0.1 --non-interactive
command failed with code 1
npm WARN lifecycle The node binary used for scripts is /tmp/yarn--1606197365634-0.8306902976665087/node but npm is using /usr/local/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
sh: tsc: not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! @ibm-cloud/secrets-manager@0.0.1 build: `tsc`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the @ibm-cloud/secrets-manager@0.0.1 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     /github/home/.npm/_logs/2020-11-24T05_56_08_320Z-debug.log
error Command failed with exit code 1.
command failed with code 1

I then changed the publish command to npm publish with --access public but it fails with:

command failed: npm publish

Some debug logs would help clarify what is going on... can those be added?

The error is already in the logs:

sh: tsc: not found

And it's because there's no tsc installed. You need to run yarn or npm install first, for example like this:

...
    steps:
      - uses: actions/checkout@v2
      - run: npm install
...

I think this is fixed now. However, feel free to reopen this or create a new issue if there are any other problems! 👍