I am using GitHub actions to auto-publish my npm package whenever I push the code to master branch. The problem is in my .gitignore I have added the /dist/ folder. So when I push the code to cloud, it ignores the dist folder and I want only dist folder to be published. How do I do this?
I tried using npm install and npm run build to create a dist folder and in the cloud and then publish the package but it doesn't work. It doesn't create a compiled version.
The only solution I see is I remove /dist/ from .gitignore and upload it to the cloud but is there any other way that I can ignore dist and also auto-publish it to npm using Github Actions?
Here are my .yml file
name: NPM Publish
on:
push:
branches:
- master
jobs:
release:
name: Pubish
runs-on: ubuntu-latest
steps:
- name: ⏬ checkout
uses: actions/checkout@v2.1.1
- name: Node
uses: actions/setup-node@v1.4.2
with:
node-version: 12
registry-url: https://registry.npmjs.org
- name: Publish
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}