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

Github tag is not released automatically #29

Closed
aditya81070 opened this issue Jun 20, 2020 · 13 comments
Closed

Github tag is not released automatically #29

aditya81070 opened this issue Jun 20, 2020 · 13 comments

Comments

@aditya81070
Copy link

I am new to GitHub actions and trying my first workflow. I have created a sample package on npm and using merge-release for automatic npm version release and GitHub tab release for any push on the master branch. The issue is that merge-release is publishing the npm package but it is not releasing the tag on Github. Am I missing something in following workflow file?

name: Publish to NPM
on:
  push:
    branches:
      - master
jobs:
  publish:
    name: Publish
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Publish to npm and github
        uses: mikeal/merge-release@v4.0.7
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

Also, I have one more question that do I need to update the version in the package.json file manually?

@mikeal
Copy link
Owner

mikeal commented Jun 20, 2020

So, it should be pushing the tag. If you look in the “Releases” tab on GitHub you should see the tag there. However, you won’t see that release associated with a package in the GitHub npm registry because there’s not an API for that yet 😥

@aditya81070
Copy link
Author

@mikeal Yeah, I am talking about the tag only. I can not see the tag but npm version is updated correctly.

Also, does this package provides any output related to version it released? For example, if it releases a version 1.2.0 and it provides this version into an output then I can use this output to update my package.json using npm version ${{ steps.merge-release.outputs.version }}. Otherwise, I have to update my package.json manually.

@rom1504
Copy link

rom1504 commented Jun 20, 2020

#28 has the answer about package.json

I guess it would be worth it to put that explanation in the readme as several people were confused about that

@aditya81070
Copy link
Author

@rom1504 Thanks. I was looking for something like that only. If I am getting right, this action is used when a release PR (with npm version updated) is merged into the master(or specified branch).

@aditya81070
Copy link
Author

@mikeal I tried to push a new commit to specified branch and again npm version is released but there are no changes in release tag of Github.

@mikeal
Copy link
Owner

mikeal commented Jun 20, 2020

If I am getting right, this action is used when a release PR (with npm version updated) is merged into the master(or specified branch).

Nope :)

Every merge of any code to master is released. We use the conventional commit messages between that commit and the commit of the latest release to decide how to bump the version (patch, minor, major) automatically. The version change in package.json is never pushed to master (it would be too noisy) but the version change is committed to the tag before it’s pushed.

If you want to create specific PR’s for releases you should check out a different project (this one by @bcoe is pretty good https://github.com/googleapis/release-please) since that’s not the workflow this is designed for.

@mikeal
Copy link
Owner

mikeal commented Jun 20, 2020

@aditya81070 can you link me to the repository you’re running this on?

@aditya81070
Copy link
Author

@mikeal Great explanation. So ideally we should push the tag from cli not from the GitHub so we can also change the package.json.

Here is the repository for which I am using this project:
https://github.com/aditya81070/github-actions-learn

@mikeal
Copy link
Owner

mikeal commented Jun 20, 2020

So, the way it should work is:

  • Tests pass
  • The github action determines the proper version to bump and edits package.json in the action.
  • npm publish
  • commit the version change
  • tag HEAD
  • push the tag

@mikeal
Copy link
Owner

mikeal commented Jun 20, 2020

@aditya81070 I see what your problem is, that’s an old bug in the tag pushing code that has since been fixed. Instead of mikeal/merge-release@v4.0.7 use mikeal/merge-release@master

@aditya81070
Copy link
Author

@mikeal why should I use the master? It isn't like always relying on latest version instead of fixing dependency?

I copied the action code from marketplace. Isn't this a latest version?

@mikeal
Copy link
Owner

mikeal commented Jun 23, 2020

why should I use the master? It isn't like always relying on latest version instead of fixing dependency?

There’s a feature request for version branches but nobody has stepped up to write that code yet. #27 (comment)

I copied the action code from marketplace. Isn't this a latest version?

Marketplace is out of date, master is latest. Marketplace doesn’t have an API for me to automate the releases so they are always going to be out of date until they fix that.

@aditya81070
Copy link
Author

The issue was resolved and I forgot to close the issue so closing this now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants