def merge(releases, schema=None, merge_rules=None):
    """
    Merges a list of releases into a compiledRelease.
    """
    if not merge_rules:
        merge_rules = get_merge_rules(schema)

    merged = OrderedDict({('tag',): ['compiled']})
    for release in sorted(releases, key=lambda release: release['date']):
        release = release.copy()

        ocid = release['ocid']
        date = release['date']
        # Prior to OCDS 1.1.4, `tag` didn't set "omitWhenMerged": true.
        release.pop('tag', None)  # becomes ["compiled"]

        flat = flatten(release, merge_rules)
        processed = process_flattened(flat)

        # Add an `id` and `date`.
        merged[('id',)] = '{}-{}'.format(ocid, date)
        merged[('date',)] = date

        # In OCDS 1.0, `ocid` incorrectly sets "mergeStrategy": "ocdsOmit".
        merged[('ocid',)] = ocid

        merged.update(processed)

    return unflatten(merged, merge_rules)