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

Action is ignoring (default) branches #24

Closed
jakobrosenberg opened this issue Mar 20, 2020 · 13 comments · Fixed by #26
Closed

Action is ignoring (default) branches #24

jakobrosenberg opened this issue Mar 20, 2020 · 13 comments · Fixed by #26
Labels

Comments

@jakobrosenberg
Copy link

Describe the bug
If I run the action on an alpha branch I get the following error

"while semantic-release is configured to only publish from master, therefore a new version won’t be published."

It doesn't make any difference whether I use the default branches or specify them manually in package.json.

@cycjimmy
Copy link
Owner

The action runs by default on the master branch. You can set the branch property to change its default behavior.

- name: Semantic Release
  uses: cycjimmy/semantic-release-action@v2
  with:
     branch: alpha     # set branch property to alpha
  env:
     GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
     NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

@jakobrosenberg
Copy link
Author

@cycjimmy thank you for the quick reply. Are there any plans to support the branches feature of semantic-release v16 ?

@cycjimmy
Copy link
Owner

Of course, the feature for branches looks good. I will support it as possible after my work.

@jakobrosenberg
Copy link
Author

Amazing! Thank you.

cycjimmy added a commit that referenced this issue Mar 21, 2020
support branches of semantic-release v16+

#24 #25
github-actions bot pushed a commit that referenced this issue Mar 21, 2020
# [2.3.0](v2.2.0...v2.3.0) (2020-03-21)

### Features

* **branches:** support branches of semantic-release v16+ ([706c0ef](706c0ef)), closes [#24](#24) [#25](#25)
@github-actions
Copy link

🎉 This issue has been resolved in version 2.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@cycjimmy
Copy link
Owner

Thanks for your issue. And now semantic-release-action@v2.3.0 supports branches. @jakobrosenberg

@jakobrosenberg
Copy link
Author

Thanks for your efforts @cycjimmy . I just tried the update, but I'm still getting the error from before.

This is my Github action:

# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI

on:
  ['push']

jobs:
  publish:

    runs-on: ubuntu-latest
  
    steps:
    - uses: actions/checkout@v2
    - uses: cycjimmy/semantic-release-action@v2.3.0
    
      env:
        GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
        NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
    - run: |
        echo $RELEASE_VERSION
        echo $RELEASE_MAJOR
        echo $RELEASE_MINOR
        echo $RELEASE_PATCH

@cycjimmy
Copy link
Owner

cycjimmy commented Mar 21, 2020

cycjimmy/semantic-release-action does not generate these environment variables:
RELEASE_VERSION, RELEASE_MAJOR, RELEASE_MINOR, RELEASE_PATCH.

You can use outputs for the same purpose:

steps:
  - uses: actions/checkout@v2
  - uses: cycjimmy/semantic-release-action@v2
    id: semantic # Need an `id` for output variables
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
  - if: steps.semantic.outputs.new_release_published == 'true'
    run: |
      echo ${{ steps.semantic.outputs.new_release_version }}
      echo ${{ steps.semantic.outputs.new_release_major_version }}
      echo ${{ steps.semantic.outputs.new_release_minor_version }}
      echo ${{ steps.semantic.outputs.new_release_patch_version }}

@cycjimmy cycjimmy reopened this Mar 21, 2020
@jakobrosenberg
Copy link
Author

I removed the run command. However I was still getting this error.

This test run was triggered on the branch alpha, while semantic-release is configured to only publish from master, actions, therefore a new version won’t be published.

My package.json

  "release": {
    "branches": [
      "master",
      "next",
      "actions",
      {"name": "alph", "prerelease": true},
      {"name": "beta", "prerelease": true}
    ]
  },

alpha had a typo which I corrected, but I wonder why only master and actions were listed.

After correcting the typo I'm now getting this error instead. (sorry for veering a little off topic here)

npm ERR! This operation requires a one-time password from your authenticator.
npm ERR! You can provide a one-time password by passing --otp=<code> to the command you ran.
npm ERR! If you already provided a one-time password then it is likely that you either typoed
npm ERR! it, or it timed out. Please try again.

Should the NPM_TOKEN not handle this?

@cycjimmy
Copy link
Owner

cycjimmy commented Mar 22, 2020

Are you working on a private repository or a protected branch? If yes, replace GITHUB_TOKEN with Personal Access Token. See setp2.

Also, you need to check whether NPM_TOKEN has authentication to publish. See authentication for plugins.

@jakobrosenberg
Copy link
Author

It's a public repo and there are no protection rules for any of the branches.

The NPM_TOKEN was generated by semantic release. I assumed it was produced with the correct configuration. I'll have a look at the link you provided.

@jakobrosenberg
Copy link
Author

I found the issue. While my account was set to 2FA auth only, the npm repo was set for 2FA publish. Sorry to trouble you with this one and thanks for all your help.

@cycjimmy
Copy link
Owner

I found the issue. While my account was set to 2FA auth only, the npm repo was set for 2FA publish. Sorry to trouble you with this one and thanks for all your help.

u r welcome. And thank you for suggestions on this action.

github-actions bot pushed a commit to Lundalogik/semantic-release-action that referenced this issue Apr 30, 2020
# [2.4.0](v2.3.3...v2.4.0) (2020-04-30)

### Bug Fixes

* rescope ([5b03139](5b03139))
* rescope to 'lundalogik' ([e951df7](e951df7))

### Features

* added ability to use the "extends" settings ([32db8a4](32db8a4))
* **branches:** support branches of semantic-release v16+ ([706c0ef](706c0ef)), closes [cycjimmy#24](https://github.com/lundalogik/semantic-release-action/issues/24) [cycjimmy#25](https://github.com/lundalogik/semantic-release-action/issues/25)
* add release notes to output ([a56320d](a56320d))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants