Files

You can define a set of additional files that should be uploaded as part of the release. These files may also be checksumed and signed before uploading.

Legend:

  • required

  • optional

  • may use environment variable

  • accepts Name Templates

  • YAML

  • TOML

  • JSON

  • Maven

  • Gradle

# 
files:

  # Defines a list of artifacts.
  # Each entry must define a path: field.
  # The path may be relative to the project's basedir or absolute.
  #  
  artifacts:
    - path: path/to/some/file.txt
    - path: path/to/another/file.md

  # Defines a list of globs.
  # 
  globs:
      # The directory to search.
      # If undefined, will use the project's basedir.
      #  
    - directory: some/directory\

      # The pattern to apply for inclusion.
      # If undefined, will use `*`.
      # 
      include: '*.txt'

      # The pattern to apply for exclusion.
      # 
      exclude: 'secret'

      # Recursive search.
      # Defaults to `false`.
      # 
      recursive: true
# 
[files]

  # Defines a list of artifacts.
  # Each entry must define a path: field.
  # The path may be relative to the project's basedir or absolute.
  #  
  artifact = [
    { path = "path/to/some/file.txt" },
    { path = "path/to/another/file.md" }
  ]

  # Defines a list of globs.
  # 
  [[files.globs]]
    # The directory to search.
    # If undefined, will use the project's basedir.
    #  
    directory = "some/directory"

    # The pattern to apply for inclusion.
    # If undefined, will use `*`.
    # 
    include = "*.txt"

    # The pattern to apply for exclusion.
    # 
    exclude = "secret"

    # Recursive search.
    # Defaults to `false`.
    # 
    recursive = true
{
  // 
  "files": {

     // Defines a list of files.
     // Each entry must define a path: field.
     // The path may be relative to the project's basedir or absolute.
     //  
    "artifacts": [
      {
        "path": "path/to/some/file.txt"
      },
      {
        "path": "path/to/another/file.md"
      }
    ],

    // Defines a list of globs.
    // 
    "globs": [
      {
        // The directory to search.
        // If undefined, will use the project's basedir.
        //  
        "directory": "some/directory",

        // The pattern to apply for inclusion.
        // If undefined, will use `*`.
        // 
        "include": "*.txt",

        // The pattern to apply for exclusion.
        // 
        "exclude": "secret",

        // Recursive search.
        // Defaults to `false`.
        // 
        "recursive": true
      }
    ]
  }
}
<jreleaser>
  <!--
    
  -->
  <files>

    <!--
      Defines a list of files.
      Each entry must define a path: field.
      The path may be relative to the project's basedir or absolute.
       
    -->
    <artifacts>
      <artifact>
        <path>path/to/some/file.txt</path>
      <artifact>
      </artifact>
        <path>path/to/another/file.md</path>
      </artifact>
    </artifacts>

    <!--
      Defines a list of globs.
      
    -->
    <globs>
      <glob>
        <!--
          The directory to search.
          If undefined, will use the project's basedir.
           
        -->
        <directory>some/directory</directory>

        <!--
          The pattern to apply for inclusion.
          If undefined, will use `*`.
          
        -->
        <include>*.txt</include>

        <!--
         The pattern to apply for exclusion.
         
        -->
        <exclude>secret</exclude>

        <!--
          Recursive search.
          Defaults to `false`.
          
        -->
        <recursive>true</recursive>
      </glob>
    </globs>
  </files>
</jreleaser>
jreleaser {
  // 
  files {
    // Defines a file entry
    // The path may be relative to the project's basedir or absolute.
    //  
    artifact {
      path = 'path/to/some/file.txt'
    }
    artifact {
      path = 'path/to/another/file.md'
    }

    // Defines a glob entry
    // 
    glob {
      // The directory to search.
      // If undefined, will use the project's basedir.
      //  
      directory = 'some/directory'

      // The pattern to apply for inclusion.
      // If undefined, will use `*`.
      // 
      include = '*.txt'

      // The pattern to apply for exclusion.
      // 
      exclude = 'secret'

      // Recursive search.
      // Defaults to `false`.
      // 
      recursive = true
    }
  }
}
One of glob.directory, glob.include, glob.exclude must be defined at the very least, otherwise the search would encompass the whole project.

Use the include and exclude patterns to narrow the search, for example given the following structure:

src/files
├── secret
│   └── waldos-location.txt
└── todo.txt

We’d like to include all *.txt files without giving away Waldo’s location; we can do this by using include and exclude like so:

  • YAML

  • TOML

  • JSON

  • Maven

  • Gradle

files:
  globs:
    - directory: src/files
      include: '*.txt'
      exclude: 'secret'
      recursive: true
[[files.globs]]
  directory = "src/files"
  include = "*.txt"
  exclude = "secret"
  recursive = true
{
  "files": {
    "globs": [
      {
        "directory": "src/files",
        "include": "*.txt",
        "exclude": "secret",
        "recursive": true
      }
    ]
  }
}
<jreleaser>
  <files>
    <globs>
      <glob>
        <directory>src/files</directory>
        <include>*.txt</include>
        <exclude>secret</exclude>
        <recursive>true</recursive>
      </glob>
    </globs>
  </files>
</jreleaser>
jreleaser {
  files {
    glob {
      directory = 'src/files'
      include = '*.txt'
      exclude = 'secret'
      recursive = true
    }
  }
}