I'm new to Github Actions. I have a project using node_modules. I would like to create artifact files without including node_modules on Github Actions since with node_modules it takes a while to create and download because of the file size. Is there a way to do this?
This one seems a bit related with this but could not figure it out how. https://github.com/actions/upload-artifact/issues/44
You can use ignore by pattern
- uses: actions/upload-artifact@v2
with:
name: my-artifact
path: |
.
!./node_modules
Source: https://github.com/actions/upload-artifact#upload-using-multiple-paths-and-exclusions
I don't think it's possible to exclude paths yet because the action only accepts a single path. According to the issue you linked, they are looking to add multiple path support in the future.
The workaround I've used is just to delete the node_modules directory before creating the artifact.
For example:
- run: |
npm ci
npm run build
npm run test
npm run package
rm -rf node_modules
- uses: actions/upload-artifact@v2
with:
name: my-artifact
path: .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With