Upload RPM and Debian packages to Ivy repository

I want to upload an RPM and a DEB that I built with the nebula-plugins to artifactory.
The artifactory plugin fails to do it, because it messes up the filename.
So I got inspired by this answer: http://stackoverflow.com/questions/38249033/upload-an-rpm-to-artifactory-from-gradle

The problem I have now is that I can’t use this specific pattern layout, because I also want to upload a DEB.
So right now I see myself reverse-engineering how Gradle interprets the Ivy pattern, and I can see myself hitting a roadblock because I cannot put the “release” property of the .rpm and .deb files (both included in the buildscript and the filename) in these patterns.
Also, the package name is actually slightly different from the project name.
How to solve this problem?

Relevant build script:

publishing {
    publications {
        rpm(IvyPublication) {
            artifact buildRpm.outputs.getFiles().getSingleFile()
            /* Ivy plugin forces an organisation to be set. Set it to anything
               as the pattern layout later supresses it from appearing in the filename */
            organisation 'anyting'
        }
        deb(IvyPublication) {
            artifact buildDeb.outputs.getFiles().getSingleFile()
            /* Ivy plugin forces an organisation to be set. Set it to anything
               as the pattern layout later supresses it from appearing in the filename */
            organisation 'anyting'
        }
    }
    repositories {
        ivy {
            credentials {
                username 'admin'
                password 'admin'
            }
            url "http://my-artifacts:8081/artifactory/my-path/"

            layout 'pattern', {
                // artifact "${buildRpm.outputs.getFiles().getSingleFile().getName()}" 
               // Doesn't work for both artifacts, RPM and DEB...
               // How to specifiy filenames for both cases ?
            }
        }
    }
}