Skip to main content

Archives

Package binaries into tar.gz, zip, tar.xz, or tar.zst archives

The archive stage packages your compiled binaries into distributable archives.

Minimal config

crates:
  - name: myapp
    archives:
      - name_template: "{{ ProjectName }}-{{ Version }}-{{ Os }}-{{ Arch }}"

Archive config fields

FieldTypeDefaultDescription
name_templatestring{{ ProjectName }}-{{ Version }}-{{ Os }}-{{ Arch }}Archive filename (without extension)
formatstringtar.gzArchive format: tar.gz, tar.xz, tar.zst, zip, binary
format_overrideslistnonePer-OS format overrides
fileslistnoneExtra files to include (e.g., LICENSE, README.md)
binarieslistallSpecific binaries to include (default: all from builds)
wrap_in_directorystringnoneWrap contents in a subdirectory

Format overrides

Use different formats for different operating systems:

archives:
  - name_template: "{{ ProjectName }}-{{ Version }}-{{ Os }}-{{ Arch }}"
    format: tar.gz
    format_overrides:
      - os: windows
        format: zip

Including extra files

archives:
  - name_template: "{{ ProjectName }}-{{ Version }}-{{ Os }}-{{ Arch }}"
    files:
      - LICENSE
      - README.md
      - config.example.yaml

Raw binary (no archive)

Use format: binary to skip archiving and distribute the raw binary:

archives:
  - format: binary
    name_template: "{{ ProjectName }}-{{ Version }}-{{ Os }}-{{ Arch }}"

Disabling archives

crates:
  - name: myapp
    archives: false    # skip archiving entirely

Full example

crates:
  - name: myapp
    archives:
      - name_template: "{{ ProjectName }}-{{ Version }}-{{ Os }}-{{ Arch }}"
        format: tar.gz
        format_overrides:
          - os: windows
            format: zip
        files: [LICENSE, README.md]
        wrap_in_directory: "{{ ProjectName }}-{{ Version }}"