ci/release/README.md
The template for the install script in the root of the d2 repository.
Generates the install.sh script in the root of the repository by prepending the libraries it depends on from ../sub/lib.
note: Remember for production releases you need to set the $TSTRUCT_OS_ARCH_BUILDER variables as we must compile d2 directly on each release target to include dagre. See https://github.com/d2lang/d2/issues/31
Use --host-only to build only the release for the host's $OS-$ARCH pair.
./docker/build.sh is retained as a load-only local development helper. It rejects
--push, --latest, and inherited RELEASE publishing. The release script no longer
calls it or publishes Docker tags from a legacy AWS SSH builder.
The manually dispatched Publish Docker release GitHub workflow is the production path
for Docker Hub. It replaces only the Docker portion of the legacy AWS release path; the
other release asset builders are unchanged.
Run it from the protected master branch after the GitHub release is published. Enter the
exact v-prefixed release version and leave publish_latest off unless this stable release
should become the default Docker image. The workflow rejects publish_latest for a GitHub
prerelease or a semver prerelease.
The docker-release GitHub environment must provide a DOCKERHUB_USERNAME variable and a
DOCKERHUB_TOKEN secret with write access to that user's d2 repository. The current
production namespace is fixed to terrastruct/d2, so DOCKERHUB_USERNAME must be
terrastruct. The environment's deployment branch policy must allow only protected
branches. Docker Hub tag immutability must remain enabled for version tags with
^v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z]+([.-][0-9A-Za-z]+)*)?$; latest remains outside
that rule and mutable. This repository-side rule is the final overwrite guard.
Before publishing a production tag, the workflow:
master commit, and uses that release commit's Dockerfile;Only then does it create the requested version tag. Existing version tags are immutable,
so the workflow refuses to overwrite one. If publish_latest was explicitly selected, it
updates latest from the immutable version-manifest digest only after the version manifest
is published and verified. If verification or latest promotion fails after the version
tag was created, use GitHub's Re-run failed jobs action: the same run accepts the
existing version tag only when its descriptors exactly match that run's verified candidate,
and the separate latest job can retry without touching the version tag. A new dispatch
still refuses any existing version tag during preflight.
The manually dispatched Docker continuity test GitHub workflow proves that an existing,
published D2 release can be rebuilt for Docker Hub without the legacy AWS builders. It
downloads the release's exact Linux archives, builds on native GitHub-hosted amd64 and arm64
runners, verifies the images, and publishes only
terrastruct/d2:continuity-test-<workflow-run-id>. It never updates a release version tag or
latest.
Dispatch the workflow from the protected master branch. The version input must name a
published, non-draft GitHub release with both Linux archives; v0.7.1 is the default
continuity fixture. Delete the continuity-test tag in Docker Hub after reviewing the
workflow summary and manifest.
The v0.7.1 fixture embeds playwright-go v0.4702.0, whose original driver CDN no longer
serves the required ZIP files. For that fixture only, the workflow reconstructs the same
Playwright 1.47.2 driver layout from a checksum-pinned official playwright-core npm
tarball and the image's Node runtime. Browser payloads use Playwright's current direct CDN.
The published D2 archive remains unchanged. Other release versions use their tagged
Dockerfile without this compatibility step.
This remains a non-production regression test. The separate Publish Docker release
workflow is the production publisher.
Called by build.sh to create a release archive.
Do not invoke directly. If you want to produce a build for a single platform run build.sh as so:
# To only build the linux-amd64 release.
./build.sh --run=linux-amd64
# To only build the linux-amd64 release locally.
./build.sh --local --run=linux-amd64