For the past few days, I'm trying to publish my package to github by using semantic-release. Unfortunately, I can't publish the correct folder as source code (zip) file in my npm package hosted on github.
My github action pipeline:
on:
push:
branches:
- main
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
defaults:
run:
working-directory: ./frontend
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
cache-dependency-path: ./frontend
- name: Install packages
run: npm install
- name: Build frontend
run: npm run build
- name: Copy json file to dist dir
run: cp package.json ./dist
- name: Run semantic release and publish package
run: |
cd ./dist
pwd
npm run semantic-release
It's supposed to publish the dist folder, but I see the whole project directory as the source code output to npm. It's not publishing my build folder. When I run pwd, I'm on the correct path: /home/runner/work/test/test/frontend/dist
Semantic-release is also not respecting my property in my package.json file:
"files": [
"/dist"
]
I specifically want to output the dist folder, but unfortunately, everything is in the output folder except the dist folder.
I also tried adding a pkgRoot property to to the '@semantic-release/npm'
module, but still! No dist folder being published.
['@semantic-release/npm', { 'pkgRoot': './dist' }],
What can be the issue of this problem?