The issue is now obviously that if I use both flags, the second publishDir overwrites the first one. Is there any possibility solve this issue in the config file, like appending to the first one or something?
I’d recommend looking at the way the nf-core flagship pipelines deal with this issue (example here)
The nf-core community uses a saveAs that returns nil if the parameter isn’t set, the file will not be published. A slightly cleaner alternative (imho) is to use the “enabled” argument to publishDir: