Reputation: 8498
I'm using standard-version
(version 9.3.2) to manage the version of my npm package, as well as generating a CHANGELOG.md. This works fine as it seems.
Additionally to this, I want to create a Github release when the version tag is pushed to git. So I have created the following Github Action:
name: Continuous deployment (NPM)
on:
push:
tags:
- v*
jobs:
build-and-deploy:
name: Build and deploy NPM package
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Configure node for npmjs.org as registry
uses: actions/setup-node@v2
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm ci
- run: npm run release:create-github-release
env:
CONVENTIONAL_GITHUB_RELEASER_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Publish package on npmjs.org
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
There is a step where I call npm run release:create-github-release
, which runs "release:create-github-release": "conventional-github-releaser -p angular"
. A release is generated, but unfortunately it doesn't contain the CHANGELOG.md
which was previously generated and is committed to the repository at the time of running the mentioned Github Action. It looks like this:
My question is: Why doesn't conventional-github-releaser
pick up my CHANGELOG.md
?
The whole project can be found here: https://github.com/openscript-ch/gatsby-plugin-i18n-l10n
Thank you for any advice.
Upvotes: 1
Views: 415
Reputation: 1137
Following could be a guess (based on docs I read about conventional-github-releaser
and actions/checkout
), so I'm not 100% sure:
When you use actions/checkout@v2
it sets to default fetch-depth: 1
which does a shallow checkout of your repository i.e. single commit is fetched by default (btw this you can see in you GHA as well, I attached a snapshot) and this could be most likely the reason why conventional-github-releaser
couldn't pickup previous content of CHANGELOG.md
as that command only "...generates a GitHub Release based on commits since the last semver tag...". When you set this explicitly to fetch-depth: 0
it fetches all git history for all branches and tags. Try and let me know as I'm interested what's the outcome.
REF:
Upvotes: 1