跳到主要内容

Archives

The binaries built will be archived together with the README and LICENSE files into a tar.gz file. In the archives section you can customize the archive name, additional files, and format.

Here is a commented archives section with all fields specified:

.kmdopkg.yaml
archives:
- #
# ID of this archive.
#
# Default: 'default'.
id: my-archive

# IDs of the builds which should be archived in this archive.
#
# Default: empty (include all).
ids:
- default

# Archive formats.
#
# If format is `binary`, no archives are created and the binaries are instead
# uploaded directly.
#
# Valid options are:
# - `tar.gz`
# - `tgz`
# - `tar.xz`
# - `txz`
# - `tar.zst`
# - `tzst`
# - `tar`
# - `gz`
# - `zip`
# - `binary`
#
# Default: ['tar.gz'].
format: "zip" # Singular form, single format, deprecated.
formats: ["zip", "tar.gz"] # Plural form, multiple formats.

# This will create an archive without any binaries, only the files are there.
# The name template must not contain any references to `Os`, `Arch` and etc, since the archive will be meta.
#
# Templates: allowed.
meta: true

# Archive name.
#
# Default:
# - if format is `binary`:
# - `{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}`
# - if format is anything else:
# - `{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}`
# Templates: allowed.
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"

# Sets the given file info to all the binaries included from the `builds`.
#
# Default: copied from the source binary.
builds_info:
group: root
owner: root
mode: 0644
# format is `time.RFC3339Nano`
mtime: 2008-01-02T15:04:05Z

# Set this to true if you want all files in the archive to be in a single directory.
# If set to true and you extract the archive 'kmdo_Linux_arm64.tar.gz',
# you'll get a directory 'kmdo_Linux_arm64'.
# If set to false, all files are extracted separately.
# You can also set it to a custom directory name (templating is supported).
# Default: false.
wrap_in_directory: true

# If set to true, will strip the parent directories away from binary files.
#
# This might be useful if you have your binary be built with a sub-directory
# for some reason, but do no want that sub-directory inside the archive.
strip_binary_directory: true

# Can be used to change the archive formats for specific GOOSs.
# Most common use case is to archive as zip on Windows.
format_overrides:
- # Which GOOS to override the format for.
goos: windows

# The formats to use for the given GOOS.
#
# Valid options are:
# - `tar.gz`
# - `tgz`
# - `tar.xz`
# - `txz`
# - `tar.zst`
# - `tzst`
# - `tar`
# - `gz`
# - `zip`
# - `binary` # be extra-cautious with the file name template in this case!
# - `none` # skips this archive
#
format: "zip" # Singular form, single format, deprecated.
formats: ["zip", "tar.gz"] # Plural form, multiple formats.

# Additional files/globs you want to add to the archive.
#
# Default: [ 'LICENSE*', 'README*', 'CHANGELOG', 'license*', 'readme*', 'changelog'].
# Templates: allowed.
files:
- LICENSE.txt
- README_{{.Os}}.md
- CHANGELOG.md
- docs/*
- design/*.png
- templates/**/*
# a more complete example, check the globbing deep dive below
- src: "*.md"
dst: docs

# Strip parent directories when adding files to the archive.
strip_parent: true

# File info.
# Not all fields are supported by all formats available formats.
#
# Default: copied from the source file.
info:
# Templates: allowed.
owner: root

# Templates: allowed.
group: root

# Must be in time.RFC3339Nano format.
#
# Templates: allowed.
mtime: "{{ .CommitDate }}"

# File mode.
mode: 0644

# Disables the binary count check.
allow_different_binary_count: true