mikeal / merge-release

Automatically release all merges to master on npm.
Other
471 stars 64 forks source link

Github tag is not released automatically #29

Closed aditya81070 closed 3 years ago

aditya81070 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

@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 commented 4 years ago

https://github.com/mikeal/merge-release/issues/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 commented 4 years ago

@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 commented 4 years ago

@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 commented 4 years ago

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 commented 4 years ago

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

aditya81070 commented 4 years ago

@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 commented 4 years ago

So, the way it should work is:

mikeal commented 4 years ago

@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 commented 4 years ago

@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 commented 4 years ago

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. https://github.com/mikeal/merge-release/issues/27#issuecomment-627428949

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 commented 3 years ago

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