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
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: .
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.