Gofish

GoFish is a cross-platform systems package manager, bringing the ease of use of Homebrew to Linux and Windows. This packager generates a fish food file band publishes it to a repository of your choice, however it' just responsibility to update the official https://github.com/fishworks/fish-food with a PR of your own.

The following artifact extensions are supported by this packager:

  • .tgz

  • .txz

  • .tar.gz

  • .tar.xz

  • .tar

  • .zip

Publication of snapshots is not allowed.

Legend:

  • required

  • optional

  • may use environment variable

  • accepts Name Templates

  • YAML

  • TOML

  • JSON

  • Maven

  • Gradle

# 
packagers:
  # 
  gofish:
    # Enables or disables Gofish.
    # Valid values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
    # Defaults to `NEVER`.
    # 
    active: ALWAYS

    # Let the release continue if the packager fails.
    # Defaults to `false`.
    # 
    continueOnError: true

    # Custom download URL.
    #  
    downloadUrl: https://my.server.com/{{projectName}}/{{tagName}}/{{artifactFile}}

    # Additional properties used when evaluating templates.
    #  
    extraProperties:
      # Key will be capitalized and prefixed with `gofish`, i.e, `gofishFoo`.
      foo: bar

    # Directory with file templates used to prepare the Gofish distribution.
    # Defaults to `src/jreleaser/distributions/${distribution.name}/gofish`.
    # If specified, path must exist.
    # 
    templateDirectory: path/to/gofish/templates

    # Git author used to commit to the repository.
    # 
    commitAuthor:
      # Name used when authoring commits.
      # Defaults to `jreleaserbot`.
      # 
      name: jreleaserbot

      # E-mail used when authoring commits.
      # Defaults to `jreleaser@kordamp.org`.
      # 
      email: jreleaser@kordamp.org

    # Git repository to push the fish food to.
    # Defaults are shown.
    # 
    repository:
      # Enables or disables the repository.
      # Valid values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
      # Defaults to `RELEASE`.
      # 
      active: ALWAYS


      # The owner of the repository.
      # Defaults to the same owner as the release repository.
      # 
      owner: duke

      # The name of the repository.
      # Defaults to `duke-fish-food`.
      # 
      name: duke-fish-food

      # The tag associated with the fish food.
      # If left unspecified, will use `{{tagName}}`.
      #  
      tagName: '{{distributionName}} {{tagName}}'

      # The target branch to use.
      # May define a `JRELEASER_GOFISH_${GIT}_BRANCH` environment variable instead.
      # Defaults to the branch pointed by HEAD.
      #  
      branch: HEAD

      # Username used for authoring commits. Must have write access to the repository.
      # If left unspecified, the `JRELEASER_GOFISH_${GIT}_USERNAME`
      # environment variable must be defined.
      # Defaults to the same username as the release repository.
      #  
      username: duke

      # Password or OAuth token with write access to the repository.
      # If left unspecified, the `JRELEASER_GOFISH_${GIT}_TOKEN`
      # environment variable must be defined.
      #  
      token: __DO_NOT_SET_HERE__

      # Message when committing to the repository.
      # If left unspecified, `{{distributionName}} {{tagName}}` will be used.
      #  
      commitMessage: '{{distributionName}} {{tagName}}'

    # Name of the Gofish package.
    # Defaults to `${distribution.name}`.
    # 
    packageName: app
# 
[packagers.gofish]
  # Enables or disables Gofish.
  # Valid values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
  # Defaults to `NEVER`.
  # 
  active = "ALWAYS"

  # Let the release continue if the packager fails.
  # Defaults to `false`.
  # 
  continueOnError = true

  # Custom download URL.
  #  
  downloadUrl = "https://my.server.com/{{projectName}}/{{tagName}}/{{artifactFile}}"

  # Additional properties used when evaluating templates.
  #  
  extraProperties.foo = "bar"
  # Key will be capitalized and prefixed with `gofish`, i.e, `gofishFoo`.

  # Directory with file templates used to prepare the Gofish distribution.
  # Defaults to `src/jreleaser/distributions/${distribution.name}/gofish`.
  # If specified, path must exist.
  # 
  templateDirectory = "path/to/gofish/templates"

  # Git author used to commit to the repository.

  # Name used when authoring commits.
  # Defaults to `jreleaserbot`.
  # 
  commitAuthor.name = "jreleaserbot"

  # E-mail used when authoring commits.
  # Defaults to `jreleaser@kordamp.org`.
  # 
  commitAuthor.email = "jreleaser@kordamp.org"

  # Git repository to push the fish food to.
  # Defaults are shown.

  # Enables or disables the repository.
  # Valid values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
  # Defaults to `RELEASE`.
  # 
  repository.active = "ALWAYS"


  # The owner of the repository.
  # Defaults to the same owner as the release repository.
  # 
  repository.owner = "duke"

  # The name of the repository.
  # Defaults to `duke-fish-food`.
  # 
  repository.name = "duke-fish-food"

  # The tag associated with the fish food.
  # If left unspecified, will use `{{tagName}}`.
  #  
  repository.tagName = "{{distributionName}} {{tagName}}"

  # The target branch to use.
  # May define a `JRELEASER_GOFISH_${GIT}_BRANCH` environment variable instead.
  # Defaults to the branch pointed by HEAD.
  #  
  repository.branch = "HEAD"

  # Username used for authoring commits. Must have write access to the repository.
  # If left unspecified, the `JRELEASER_GOFISH_${GIT}_USERNAME`
  # environment variable must be defined.
  # Defaults to the same username as the release repository.
  #  
  repository.username = "duke"

  # Password or OAuth token with write access to the repository.
  # If left unspecified, the `JRELEASER_GOFISH_${GIT}_TOKEN`
  # environment variable must be defined.
  #  
  repository.token = "__DO_NOT_SET_HERE__"

  # Message when committing to the repository.
  # If left unspecified, `{{distributionName}} {{tagName}}` will be used.
  #  
  repository.commitMessage = "{{distributionName}} {{tagName}}"

  # Name of the Gofish package.
  # Defaults to `${distribution.name}`.
  # 
  packageName = "app"
{
  // 
  "packagers": {
    // 
    "gofish": {
      // Enables or disables Gofish.
      // Valid values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
      // Defaults to `NEVER`.
      // 
      "active": "ALWAYS",

      // Let the release continue if the packager fails.
      // Defaults to `false`.
      // 
      "continueOnError": true,

      // Custom download URL.
      //  
      "downloadUrl": "https://my.server.com/{{projectName}}/{{tagName}}/{{artifactFile}}",

      // Additional properties used when evaluating templates.
      //  
      "extraProperties": {
        // Key will be capitalized and prefixed with `gofish`, i.e, `gofishFoo`.
        "foo": "bar"
      },

      // Directory with file templates used to prepare the Gofish distribution.
      // Defaults to `src/jreleaser/distributions/${distribution.name}/gofish`.
      // If specified, path must exist.
      // 
      "templateDirectory": "path/to/gofish/templates",

      // Git author used to commit to the repository.
      // 
      "commitAuthor": {
        // Name used when authoring commits.
        // Defaults to `jreleaserbot`.
        // 
        "name": "jreleaserbot",

        // E-mail used when authoring commits.
        // Defaults to `jreleaser@kordamp.org`.
        // 
        "email": "jreleaser@kordamp.org"
      },

      // Git repository to push the fish food to.
      // Defaults are shown.
      // 
      "repository": {
        // Enables or disables the repository.
        // Valid values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
        // Defaults to `RELEASE`.
        // 
        "active": "ALWAYS",


        // The owner of the repository.
        // Defaults to the same owner as the release repository.
        // 
        "owner": "duke",

        // The name of the repository.
        // Defaults to `duke-fish-food`.
        // 
        "name": "duke-fish-food",

        // The tag associated with the fish food.
        // If left unspecified, will use `{{tagName}}`.
        //  
        "tagName": "{{distributionName}} {{tagName}}",

        // The target branch to use.
        // May define a `JRELEASER_GOFISH_${GIT}_BRANCH` environment variable instead.
        // Defaults to the branch pointed by HEAD.
        //  
        "branch": "HEAD",

        // Username used for authoring commits. Must have write access to the repository.
        // If left unspecified, the `JRELEASER_GOFISH_${GIT}_USERNAME`
        // environment variable must be defined.
        // Defaults to the same username as the release repository.
        //  
        "username": "duke",

        // Password or OAuth token with write access to the repository.
        // If left unspecified, the `JRELEASER_GOFISH_${GIT}_TOKEN`
        // environment variable must be defined.
        //  
        "token": "__DO_NOT_SET_HERE__",

        // Message when committing to the repository.
        // If left unspecified, `{{distributionName}} {{tagName}}` will be used.
        //  
        "commitMessage": "{{distributionName}} {{tagName}}"
      },

      // Name of the Gofish package.
      // Defaults to `${distribution.name}`.
      // 
      "packageName": "app",
    }
  }
}
<jreleaser>
  <!--
    
  -->
  <packagers>
    <!--
      
    -->
    <gofish>
      <!--
        Enables or disables Gofish.
        Valid values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
        Defaults to `NEVER`.
        
      -->
      <active>ALWAYS</active>

      <!--
        Let the release continue if the packager fails.
        Defaults to `false`.
        
      -->
      <continueOnError>true</continueOnError>

      <!--
        Custom download URL.
         
      -->
      <downloadUrl>https://my.server.com/{{projectName}}/{{tagName}}/{{artifactFile}}</downloadUrl>

      <!--
        Additional properties used when evaluating templates.
         
      -->
      <extraProperties>
        <!--
          Key will be capitalized and prefixed with `gofish`, i.e, `gofishFoo`.
        -->
        <foo>bar</foo>
      </extraProperties>

      <!--
        Directory with file templates used to prepare the Gofish distribution.
        Defaults to `src/jreleaser/distributions/${distribution.name}/gofish`.
        If specified, path must exist.
        
      -->
      <templateDirectory>path/to/gofish/templates</templateDirectory>

      <!--
        Git author used to commit to the repository.
        
      -->
      <commitAuthor>

        <!--
           Name used when authoring commits.
          Defaults to `jreleaserbot`.
          
        -->
        <name>jreleaserbot</name>

        <!--
          E-mail used when authoring commits.
          Defaults to `jreleaser@kordamp.org`.
          
        -->
        <email>jreleaser@kordamp.org</email>
      </commitAuthor>

      <!--
        Git repository to push the fish food to.
        Defaults are shown.
        
      -->
      <repository>
        <!--
          Enables or disables the repository.
          Valid values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
          Defaults to `RELEASE`.
          
        -->
        <active>ALWAYS</active>


        <!--
          The owner of the repository.
          Defaults to the same owner as the release repository.
          
        -->
        <owner>duke</owner>

        <!--
          The name of the repository.
          Defaults to `duke-fish-food`.
          
        -->
        <name>duke-fish-food</name>

        <!--
          The tag associated with the fish food.
          If left unspecified, will use `{{tagName}}`.
           
        -->
        <tagName>{{distributionName}} {{tagName}}</tagName>

        <!--
          The target branch to use.
          May define a `JRELEASER_GOFISH_${GIT}_BRANCH`` environment variable instead.
          Defaults to the branch pointed by HEAD.
           
        -->
        <branch>HEAD</branch>

        <!--
          Username used for authoring commits. Must have write access to the repository.
          If left unspecified, the `JRELEASER_GOFISH_${GIT}_USERNAME`
          environment variable must be defined.
          Defaults to the same username as the release repository.
           
        -->
        <username>duke</username>

        <!--
          Password or OAuth token with write access to the repository.
          If left unspecified, the `JRELEASER_GOFISH_${GIT}_TOKEN`
          environment variable must be defined.
           
        -->
        <token>__DO_NOT_SET_HERE__</token>

        <!--
          Message when committing to the repository.
          If left unspecified, `{{distributionName}} {{tagName}}` will be used.
           
        -->
        <commitMessage>{{distributionName}} {{tagName}}</commitMessage>
      </repository>

      <!--
        Name of the Gofish package.
        Defaults to `${distribution.name}`.
        
      -->
      <packageName>app</packageName>
    </gofish>
  </packagers>
</jreleaser>
jreleaser {
  // 
  packagers {
    // 
    gofish {
      // Enables or disables Gofish.
      // Valid values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
      // Defaults to `NEVER`.
      // 
      active = 'ALWAYS'

      // Let the release continue if the packager fails.
      // Defaults to `false`.
      // 
      continueOnError = true

      // Custom download URL.
      //  
      downloadUrl = 'https://my.server.com/{{projectName}}/{{tagName}}/{{artifactFile}}'

      // Additional properties used when evaluating templates.
      // Key will be capitalized and prefixed with `gofish`, i.e, `gofishFoo`.
      //  
      extraProperties.put('foo', 'bar')

      // Directory with file templates used to prepare the Gofish distribution.
      // Defaults to `src/jreleaser/distributions/${distribution.name}/gofish`.
      // If specified, path must exist.
      // 
      templateDirectory = 'path/to/gofish/templates'

      // Git author used to commit to the repository.
      // 
      commitAuthor {
        // Name used when authoring commits.
        // Defaults to `jreleaserbot`.
        // 
        name = 'jreleaserbot'

        // E-mail used when authoring commits.
        // Defaults to `jreleaser@kordamp.org`.
        // 
        email = 'jreleaser@kordamp.org'
      }

      // Git repository to push the fish food to.
      // Defaults are shown.
      // 
      repository {
        // Enables or disables the repository.
        // Valid values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
        // Defaults to `RELEASE`.
        // 
        active = 'ALWAYS'


        // The owner of the repository.
        // Defaults to the same owner as the release repository.
        // 
        owner = 'duke'

        // The name of the repository.
        // Defaults to `duke-fish-food`.
        // 
        name = 'duke-fish-food'

        // The tag associated with the fish food.
        // If left unspecified, will use `{{tagName}}`.
        //  
        tagName = '{{distributionName}} {{tagName}}'

        // The target branch to use.
        // May define a `JRELEASER_BRANCH` environment variable instead.
        // Defaults to the branch pointed by HEAD.
        //  
        branch = 'HEAD'

        // Username used for authoring commits. Must have write access to the repository.
        // If left unspecified, the `JRELEASER_GOFISH_${GIT}_USERNAME`
        // environment variable must be defined.
        // Defaults to the same username as the release repository.
        //  
        username = 'duke'

        // Password or OAuth token with write access to the repository.
        // If left unspecified, the `JRELEASER_GOFISH_${GIT}_TOKEN`
        // environment variable must be defined.
        //  
        token = '__DO_NOT_SET_HERE__'

        # Message when committing to the repository.
        # If left unspecified, `{{distributionName}} {{tagName}}` will be used.
        #  
        commitMessage = '{{distributionName}} {{tagName}}'
      }

      // Name of the Gofish package.
      // Defaults to `${distribution.name}`.
      // 
      packageName = 'app'
    }
  }
}

Tokens

The repository token environment variable must match with the chosen Release service that is, it must be one of:
  • JRELEASER_GOFISH_GITHUB_TOKEN

  • JRELEASER_GOFISH_GITLAB_TOKEN

  • JRELEASER_GOFISH_GITEA_TOKEN

  • JRELEASER_GOFISH_CODEBERG_TOKEN

If a matching token is not found then the releaser’s token will be used instead:

  • JRELEASER_GITHUB_TOKEN

  • JRELEASER_GITLAB_TOKEN

  • JRELEASER_GITEA_TOKEN

  • JRELEASER_CODEBERG_TOKEN

On GitHub, you can’t use the default secrets.GITHUB_TOKEN as this token only works for the repository that’s running the workflow. You must configure a Personal Access Token instead.

DownloadURL

JReleaser follows these rules to find the download URL to use for a given artifact:

  1. if artifact.extraProperties.gofishDownloadUrl exists, use it.

  2. if artifact.extraProperties.downloadUrl exists, use it.

  3. if explicit downloadUrl is set on gofish, use it.

  4. if distribution.extraProperties.gofishDownloadUrl exists, use it.

  5. if distribution.extraProperties.downloadUrl exists, use it.

  6. if releaser.${git}.skipRelease is false then use the releaser’s downloadUrl.

  7. if releaser.${git}.skipRelease is true then look for a matching uploader given an extraProperty named downloadUrlFrom on artifact, distribution, `gofish (in that order). The value must be <uploaderType>:<uploaderName> such as "artifactory:app" or "s3:uploads".

  8. fail if no suitable URL is found.

With no extra configuration from your side rule 6. will be chosen which is the suitable default that most projects need.

Example

Assuming the current version is 1.2.3, and a distribution named app, the above configuration will generate a Foo/app.lua file in the duke/duke-fish-food repository:

local name = "app"
local version = "1.2.3"

food = {
    name = name,
    description = "Awesome App",
    license = "Apache-2.0"
    homepage = "https://acme.com/app",
    version = version,
    packages = {
        {
            os = "darwin",
            arch = "amd64",
            url = "https://github.com/duke/" .. name .. "/releases/download/v" .. version .. "/" .. name .. "-" .. version .. ".zip",
            sha256 = "d619026717cf198ea328e1dd8db5a3498bc69138830772bcd5fe06b2d9367482",
            resources = {
                {
                    path = name .. "-" .. version .. "/bin/" .. name,
                    installpath = "bin/" .. name,
                    executable = true
                }
            }
        },
        {
            os = "darwin",
            arch = "arm64",
            url = "https://github.com/duke/" .. name .. "/releases/download/v" .. version .. "/" .. name .. "-" .. version .. ".zip",
            sha256 = "d619026717cf198ea328e1dd8db5a3498bc69138830772bcd5fe06b2d9367482",
            resources = {
                {
                    path = name .. "-" .. version .. "/bin/" .. name,
                    installpath = "bin/" .. name,
                    executable = true
                }
            }
        },
        {
            os = "linux",
            arch = "amd64",
            url = "https://github.com/duke/" .. name .. "/releases/download/v" .. version .. "/" .. name .. "-" .. version .. ".zip",
            sha256 = "d619026717cf198ea328e1dd8db5a3498bc69138830772bcd5fe06b2d9367482",
            resources = {
                {
                    path = name .. "-" .. version .. "/bin/" .. name,
                    installpath = "bin/" .. name,
                    executable = true
                }
            }
        },
        {
            os = "linux",
            arch = "arm64",
            url = "https://github.com/duke/" .. name .. "/releases/download/v" .. version .. "/" .. name .. "-" .. version .. ".zip",
            sha256 = "d619026717cf198ea328e1dd8db5a3498bc69138830772bcd5fe06b2d9367482",
            resources = {
                {
                    path = name .. "-" .. version .. "/bin/" .. name,
                    installpath = "bin/" .. name,
                    executable = true
                }
            }
        },
        {
            os = "windows",
            arch = "amd64",
            url = "https://github.com/duke/" .. name .. "/releases/download/v" .. version .. "/" .. name .. "-" .. version .. ".zip",
            sha256 = "d619026717cf198ea328e1dd8db5a3498bc69138830772bcd5fe06b2d9367482",
            resources = {
                {
                    path = name .. "-" .. version .. "\\bin\\" .. name .. ".bat",
                    installpath = "bin\\" .. name .. ".bat",
                    executable = true
                }
            }
        },
        {
            os = "windows",
            arch = "arm64",
            url = "https://github.com/duke/" .. name .. "/releases/download/v" .. version .. "/" .. name .. "-" .. version .. ".zip",
            sha256 = "d619026717cf198ea328e1dd8db5a3498bc69138830772bcd5fe06b2d9367482",
            resources = {
                {
                    path = name .. "-" .. version .. "\\bin\\" .. name .. ".bat",
                    installpath = "bin\\" .. name .. ".bat",
                    executable = true
                }
            }
        },
    }
}

Skip Artifacts

If there is more than one matching artifact in a given distribution you may add a skipGofish extra property to the target artifact to mark it as skipped for packaging with Gofish.

Templates

The default location for templates is:

src/jreleaser/distributions/<distribution-name>/gofish

The following list shows the filenames that may be used to override default templates:

  • food.lua.tpl

Any additional files found in the template directories will be copied as is unless their filename ends with .tpl in which case Name Templates substitution will take place.

Templates may be initialized using the template command