melange YAML Reference

This page provides a reference for melange’s YAML specification.

package

This section defines metadata about the apk package being built.

DirectiveExpects
name(String) Name of the package.
version(String) Version of the package.
epoch(String) Useful to force the package to be seen as newer than any previous version with a lower epoch.
description(String) A description of the package.
target-architecture(Array) Architectures for which the package will be built. Use ‘all’ for all available architectures.
copyright(Array) License and copyright information.
dependencies(Array) List of runtime dependencies for this package. These will get pulled via apk as system dependencies when the package is installed.

Example

package:
  name: hello
  version: 2.12
  epoch: 0
  description: 'the GNU hello world program'
  target-architecture:
    - all
  copyright:
    - paths:
        - '*'
      attestation: |
        Copyright 1992, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2005,
        2006, 2007, 2008, 2010, 2011, 2013, 2014, 2022 Free Software Foundation,
        Inc.
      license: GPL-3.0-or-later
  dependencies:
    runtime:

environment

This section defines the build environment, specifying dependencies that need to be present at build time.

DirectiveExpects
contents(Array) Defines the packages that will be installed for running the build pipeline, and the repositories where to download them.

Example

environment:
  contents:
    repositories:
      - 'https://dl-cdn.alpinelinux.org/alpine/edge/main'
    packages:
      - alpine-baselayout-data
      - busybox
      - build-base
      - scanelf
      - ssl_client
      - ca-certificates-bundle

NOTE: do not mix Alpine apk repositories with Wolfi apk repositories when defining your software sources.

pipeline

Defines the build steps.

DirectiveExpects
uses(String) Uses a built-in pipeline.
with(Array) Provide parameters to a “uses” directive.

Example

- uses: fetch
  with:
    uri: https://ftp.gnu.org/gnu/hello/hello-${{package.version}}.tar.gz
    expected-sha256: cf04af86dc085268c5f4470fbae49b18afbc221b78096aab842d934a76bad0ab
- uses: autoconf/configure
- uses: autoconf/make
- uses: autoconf/make-install
- uses: strip

subpackages

Creates subpackages for documentation and additional (dev) headers, which may not be necessary at runtime.

DirectiveExpects
name(String)
pipeline(Array)

Example

subpackages:
  - name: hello-doc
    pipeline:
      - uses: split/manpages