Build npm next too; release generator with upstream notes + provenance; tags cleanup
Sync upstream and build images / sync-and-build (push) Successful in 2m35s
Sync upstream and build images / sync-and-build (push) Successful in 2m35s
- CI plan: candidates are npm latest AND next (release candidates), plus an
optional workflow_dispatch 'version' input for any exact version. This is
what was holding back 0.1.5-rc.2 (published as next, not latest).
- Upstream dsh-v* tags are no longer mirrored into this repo (deleted the
existing ones); master stays an exact branch mirror and every release links
to its upstream tag. This repo's tags are now exclusively v<image tag>.
- Dockerfile: build-provenance labels (org.opencontainers.image.revision /
.created, dev.milesward.ci-run) so releases cite the commit and CI run that
actually built the image instead of whatever HEAD is at publish time.
- Releases: shell template replaced by .gitea/scripts/publish-releases.js,
run on the node:22 base image (no runner deps). It pulls the upstream
GitHub release's English notes, adds version-dependent caveats (launch
token from 0.1.2, Session format V3 from 0.1.5), image facts and Unraid
deploy steps. Existing v* tags re-pointed to 2d033c3 (the commit that
built those images); their releases are regenerated in this format.
- README: dynamic badges (shields Gitea release, Gitea workflow status),
0.1.5-rc.2 row, pipeline/tag-namespace docs updated.
Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
1 parent
1a13239fb6
commit
ca70b61844
4 files changed
+354
-116
No files matched your search
@@ -0,0 +1,267 @@
|
||||
// Publish a `v<image tag>` git tag and Gitea release for every container image
|
||||
// tag in the registry that has no release yet. Idempotent; safe to run every
|
||||
// CI cycle. Runs on plain Node 22 (the image base) with no dependencies:
|
||||
// docker run --rm -i -e ... node:22-bookworm-slim node - < publish-releases.js
|
||||
//
|
||||
// Env: GITEA (default https://gitea.milesward.dev), OWNER, REPO (owner/name),
|
||||
// IMAGE (owner/name in the registry), GITEA_TOKEN (repo write),
|
||||
// REG_TOKEN (read:package), MAIN_SHA, RUN_NUMBER, DRY_RUN=1 (print only).
|
||||
//
|
||||
// Provenance: the release points at the image's org.opencontainers.image.revision
|
||||
// label (the main commit CI built from). Images built before that label existed
|
||||
// fall back to a pre-existing tag's commit, then to MAIN_SHA — and say so.
|
||||
|
||||
'use strict';
|
||||
|
||||
const env = (k, d) => {
|
||||
const v = process.env[k];
|
||||
if (v !== undefined && v !== '') return v;
|
||||
if (d !== undefined) return d;
|
||||
throw new Error(`missing env ${k}`);
|
||||
};
|
||||
|
||||
const GITEA = env('GITEA', 'https://gitea.milesward.dev').replace(/\/$/, '');
|
||||
const OWNER = env('OWNER');
|
||||
const REPO = env('REPO');
|
||||
const IMAGE = env('IMAGE');
|
||||
const GITEA_TOKEN = env('GITEA_TOKEN');
|
||||
const REG_TOKEN = env('REG_TOKEN');
|
||||
const MAIN_SHA = env('MAIN_SHA');
|
||||
const RUN_NUMBER = env('RUN_NUMBER', '');
|
||||
const DRY_RUN = process.env.DRY_RUN === '1';
|
||||
const REGISTRY = new URL(GITEA).host;
|
||||
const UPSTREAM = 'deepseek-ai/deepseek-harness';
|
||||
const UA = 'deepseek-harness-release-bot/1.0';
|
||||
|
||||
const MANIFEST_ACCEPT = [
|
||||
'application/vnd.docker.distribution.manifest.v2+json',
|
||||
'application/vnd.oci.image.manifest.v1+json',
|
||||
].join(',');
|
||||
|
||||
async function gitea(method, path, body) {
|
||||
const res = await fetch(`${GITEA}/api/v1${path}`, {
|
||||
method,
|
||||
headers: {
|
||||
Authorization: `token ${GITEA_TOKEN}`,
|
||||
'Content-Type': 'application/json',
|
||||
'User-Agent': UA,
|
||||
},
|
||||
body: body === undefined ? undefined : JSON.stringify(body),
|
||||
});
|
||||
const text = await res.text();
|
||||
let json = null;
|
||||
try { json = text ? JSON.parse(text) : null; } catch { /* non-JSON error body */ }
|
||||
return { status: res.status, json, text };
|
||||
}
|
||||
|
||||
async function registry(path, accept) {
|
||||
const auth = Buffer.from(`${OWNER}:${REG_TOKEN}`).toString('base64');
|
||||
return fetch(`https://${REGISTRY}/v2/${IMAGE}/${path}`, {
|
||||
headers: { Authorization: `Basic ${auth}`, Accept: accept, 'User-Agent': UA },
|
||||
});
|
||||
}
|
||||
|
||||
// --- versions -------------------------------------------------------------
|
||||
|
||||
/** Sort key for "0.1.5-rc.2" / "0.1.5-alpha.1" / "0.1.1-rc.2-r57". */
|
||||
function versionKey(tag) {
|
||||
const m = /^(\d+)\.(\d+)\.(\d+)(?:-(alpha|beta|rc)\.(\d+))?(?:-r(\d+))?$/.exec(tag);
|
||||
if (!m) return [Infinity];
|
||||
const pre = { alpha: 0, beta: 1, rc: 2 }[m[4]] ?? 3;
|
||||
return [+m[1], +m[2], +m[3], pre, +(m[5] ?? 0), +(m[6] ?? 0)];
|
||||
}
|
||||
const compareVersions = (a, b) => {
|
||||
const ka = versionKey(a), kb = versionKey(b);
|
||||
for (let i = 0; i < Math.max(ka.length, kb.length); i++) {
|
||||
const d = (ka[i] ?? 0) - (kb[i] ?? 0);
|
||||
if (d) return d;
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
const dshVersionOf = (tag) => tag.replace(/-r\d+$/, '');
|
||||
const isRevision = (tag) => /-r\d+$/.test(tag);
|
||||
const atLeast = (ver, target) => compareVersions(ver.split('-')[0], target) >= 0;
|
||||
|
||||
// --- upstream release notes ------------------------------------------------
|
||||
|
||||
async function upstreamNotes(ver) {
|
||||
const res = await fetch(`https://api.github.com/repos/${UPSTREAM}/releases/tags/dsh-v${ver}`, {
|
||||
headers: { 'User-Agent': UA, Accept: 'application/vnd.github+json' },
|
||||
});
|
||||
if (!res.ok) return null;
|
||||
const rel = await res.json();
|
||||
const body = rel.body || '';
|
||||
// Notes are bilingual; keep the English half, demote its headings under ours.
|
||||
// Upstream mixes HTML <h3> (the anchored first heading) with markdown ###.
|
||||
const i = body.search(/<h3 id="en-/);
|
||||
let en = (i >= 0 ? body.slice(i) : body)
|
||||
.replace(/<h3[^>]*>(.*?)<\/h3>/g, '#### $1')
|
||||
.replace(/^###\s+(?!#)/gm, '#### ')
|
||||
.replace(/^\s*Full Changelog:.*$/gm, '')
|
||||
.replace(/^\s*---\s*$/gm, '')
|
||||
.replace(/\n{3,}/g, '\n\n')
|
||||
.trim();
|
||||
if (en.length > 7000) {
|
||||
en = en.slice(0, 7000).replace(/\s+\S*$/, '') + '\n\n_…truncated — the full list is in the upstream notes below._';
|
||||
}
|
||||
return { markdown: en, date: (rel.published_at || '').slice(0, 10), url: rel.html_url };
|
||||
}
|
||||
|
||||
// --- deployment caveats that depend on the dsh version -----------------------
|
||||
|
||||
function caveats(ver) {
|
||||
const out = [];
|
||||
if (atLeast(ver, '0.1.5')) {
|
||||
out.push(
|
||||
'**Session format V3 — no downgrade.** Upstream migrates existing session logs on first start (originals are kept alongside, but migrated sessions cannot be opened by older versions). **Back up `/mnt/user/appdata/deepseek-harness` first.**',
|
||||
'**Default tool set changed** for SDK/Headless/ACP (read/write/edit for file editing); the Web `minimal` preset now provides only a persistent shell.',
|
||||
);
|
||||
}
|
||||
if (atLeast(ver, '0.1.2')) {
|
||||
out.push(
|
||||
'**One-time launch token.** The Web UI requires the token printed in the startup log (`docker logs DeepSeek-Harness`); it rotates on every restart and is exchanged for a ~30-day cookie bound to the origin you open it on — do the exchange on the hostname you will actually use.',
|
||||
'**Remote gateway replaces the legacy ApiProxy.** `@goodandready/dsh-lanmode` ≤ 0.6.8 breaks the web client bootstrap (`web boot: … waiting for services: remote.*`). Remove or update it *before* changing the tag: `docker exec DeepSeek-Harness dsh plugin --profile web remove @goodandready/dsh-lanmode`.',
|
||||
'**Public WebFetch is enabled by default** (with SSRF protection, no per-request approval).',
|
||||
);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
// --- image facts ----------------------------------------------------------
|
||||
|
||||
async function imageFacts(tag) {
|
||||
const res = await registry(`manifests/${tag}`, MANIFEST_ACCEPT);
|
||||
if (!res.ok) throw new Error(`manifest ${tag}: HTTP ${res.status}`);
|
||||
const digest = res.headers.get('docker-content-digest') || '';
|
||||
const manifest = await res.json();
|
||||
const cfgDigest = manifest.config?.digest;
|
||||
let labels = {};
|
||||
if (cfgDigest) {
|
||||
const blob = await registry(`blobs/${cfgDigest}`, '*/*');
|
||||
if (blob.ok) labels = (await blob.json()).config?.Labels ?? {};
|
||||
}
|
||||
return {
|
||||
digest,
|
||||
pnpm: labels['dev.milesward.pnpm-version'] || '',
|
||||
base: labels['dev.milesward.base-digest'] || '',
|
||||
revision: labels['org.opencontainers.image.revision'] || '',
|
||||
ciRun: labels['dev.milesward.ci-run'] || '',
|
||||
created: labels['org.opencontainers.image.created'] || '',
|
||||
};
|
||||
}
|
||||
|
||||
// --- release body ------------------------------------------------------------
|
||||
|
||||
function renderBody({ tag, ver, facts, builtFrom, notes }) {
|
||||
const pull = `gitea.milesward.dev/${IMAGE}:${tag}`;
|
||||
const intro = isRevision(tag)
|
||||
? `Toolchain refresh of **DeepSeek Harness (dsh) ${ver}**: the same upstream release, rebuilt with the current pnpm and a freshly patched \`node:22-bookworm-slim\` base.`
|
||||
: `Container build of **DeepSeek Harness (dsh) ${ver}** from the official npm release, built and smoke-tested by CI.`;
|
||||
|
||||
const lines = [
|
||||
intro, '',
|
||||
'```', `docker pull ${pull}`, '```', '',
|
||||
"### What's inside", '',
|
||||
'| | |', '|---|---|',
|
||||
`| dsh | \`${ver}\` — [upstream release notes](https://github.com/${UPSTREAM}/releases/tag/dsh-v${ver}) |`,
|
||||
`| pnpm | \`${facts.pnpm || 'unknown'}\` |`,
|
||||
`| base image | \`${facts.base || 'unknown'}\` |`,
|
||||
`| image digest | \`${facts.digest}\` |`,
|
||||
`| built from | ${builtFrom} |`,
|
||||
'',
|
||||
];
|
||||
|
||||
const cav = caveats(ver);
|
||||
if (cav.length) {
|
||||
lines.push('### Before switching to this tag', '', ...cav.map((c) => `- ${c}`), '');
|
||||
}
|
||||
|
||||
if (notes && notes.markdown) {
|
||||
lines.push(`### Upstream highlights (dsh ${ver}, released ${notes.date})`, '', notes.markdown, '',
|
||||
`Full notes: [dsh-v${ver}](${notes.url}).`, '');
|
||||
} else {
|
||||
lines.push('### Upstream highlights', '',
|
||||
`See the upstream notes for [dsh-v${ver}](https://github.com/${UPSTREAM}/releases/tag/dsh-v${ver}).`, '');
|
||||
}
|
||||
|
||||
lines.push(
|
||||
'### Deploy on Unraid', '',
|
||||
`- **Repository:** \`${pull}\``,
|
||||
'- **Post Arguments** (replace the image command entirely): `web --patch /opt/deepseek-harness/web.cordis.patch.yml --no-open --trusted-host <host> [--trusted-host <host2>]`',
|
||||
'- First run: `chown -R 1000:1000 /mnt/user/appdata/deepseek-harness`',
|
||||
'',
|
||||
`Image tags are immutable — this release will never be rebuilt or moved. See the [README](${GITEA}/${REPO}#versions-and-upgrades) for the upgrade procedure.`,
|
||||
);
|
||||
return lines.join('\n');
|
||||
}
|
||||
|
||||
function renderTitle(tag, ver, facts) {
|
||||
return isRevision(tag)
|
||||
? `v${tag} — dsh ${ver} toolchain refresh (pnpm ${facts.pnpm || '?'})`
|
||||
: `v${tag} — dsh ${ver} · pnpm ${facts.pnpm || '?'} · node 22`;
|
||||
}
|
||||
|
||||
// --- main -----------------------------------------------------------------
|
||||
|
||||
async function registryTags() {
|
||||
const name = IMAGE.split('/')[1];
|
||||
const { status, json } = await gitea('GET', `/packages/${OWNER}?type=container&q=${name}&limit=100`);
|
||||
if (status !== 200 || !Array.isArray(json)) throw new Error(`package list: HTTP ${status}`);
|
||||
return json
|
||||
.filter((p) => p.name === name && !p.version.startsWith('sha256:'))
|
||||
.map((p) => p.version)
|
||||
.sort(compareVersions);
|
||||
}
|
||||
|
||||
async function publish(tag) {
|
||||
const rel = `v${tag}`;
|
||||
const existing = await gitea('GET', `/repos/${REPO}/releases/tags/${rel}`);
|
||||
if (existing.status === 200) { console.log(`${rel}: release exists`); return; }
|
||||
if (existing.status !== 404) throw new Error(`${rel}: release lookup HTTP ${existing.status}`);
|
||||
|
||||
const ver = dshVersionOf(tag);
|
||||
const facts = await imageFacts(tag);
|
||||
const notes = await upstreamNotes(ver);
|
||||
|
||||
// Where does the tag point? Prefer the image's own recorded source commit.
|
||||
let target = facts.revision;
|
||||
let builtFrom;
|
||||
const tagLookup = await gitea('GET', `/repos/${REPO}/tags/${rel}`);
|
||||
if (target) {
|
||||
builtFrom = `\`main@${target}\` (image built by CI run #${facts.ciRun || '?'})`;
|
||||
} else if (tagLookup.status === 200) {
|
||||
target = tagLookup.json.commit.sha;
|
||||
builtFrom = `\`main@${target}\` (image predates build-provenance labels; release published by CI run #${RUN_NUMBER || '?'})`;
|
||||
} else {
|
||||
target = MAIN_SHA;
|
||||
builtFrom = `\`main@${target}\` (image predates build-provenance labels; release published by CI run #${RUN_NUMBER || '?'})`;
|
||||
}
|
||||
|
||||
const title = renderTitle(tag, ver, facts);
|
||||
const body = renderBody({ tag, ver, facts, builtFrom, notes });
|
||||
const prerelease = /alpha|beta/.test(ver);
|
||||
|
||||
if (DRY_RUN) {
|
||||
console.log(`\n===== DRY RUN ${rel} → ${target} (prerelease=${prerelease}) =====\n${title}\n\n${body}\n`);
|
||||
return;
|
||||
}
|
||||
|
||||
if (tagLookup.status === 404) {
|
||||
const t = await gitea('POST', `/repos/${REPO}/tags`, {
|
||||
tag_name: rel, target, message: `deepseek-harness image ${tag}`,
|
||||
});
|
||||
if (![201, 409].includes(t.status)) throw new Error(`${rel}: tag create HTTP ${t.status} ${t.text.slice(0, 200)}`);
|
||||
console.log(`${rel}: tag → ${target.slice(0, 10)} (HTTP ${t.status})`);
|
||||
}
|
||||
const r = await gitea('POST', `/repos/${REPO}/releases`, {
|
||||
tag_name: rel, target_commitish: target, name: title, body, draft: false, prerelease,
|
||||
});
|
||||
if (r.status !== 201) throw new Error(`${rel}: release create HTTP ${r.status} ${r.text.slice(0, 200)}`);
|
||||
console.log(`${rel}: release published — ${title}`);
|
||||
}
|
||||
|
||||
(async () => {
|
||||
const tags = await registryTags();
|
||||
console.log(`registry tags: ${tags.join(', ') || '(none)'}`);
|
||||
for (const tag of tags) await publish(tag);
|
||||
})().catch((err) => { console.error(`::error::${err.message}`); process.exit(1); });
|
||||
@@ -3,13 +3,16 @@ name: Sync upstream and build images
|
||||
# Keeps this repository current with the official upstream
|
||||
# (https://github.com/deepseek-ai/deepseek-harness) and the registry stocked
|
||||
# with IMMUTABLE version tags:
|
||||
# 1. Mirrors upstream master and dsh-v* tags into this repo.
|
||||
# 2. Builds a new <version> tag when a new @deepseek-ai/dsh appears on npm
|
||||
# and the registry lacks it.
|
||||
# 1. Mirrors upstream master into this repo's master branch.
|
||||
# 2. Builds a new <version> tag for each @deepseek-ai/dsh release that npm
|
||||
# publishes as `latest` or `next` (plus any version named in a manual
|
||||
# dispatch) and the registry lacks.
|
||||
# 3. Freshness check for the PINNED default version (ARG DSH_VERSION in the
|
||||
# Dockerfile): if a newer pnpm release or a patched node base image has
|
||||
# shipped since the newest existing build of that version, builds a
|
||||
# <version>-r<run> revision tag with the updated toolchain.
|
||||
# 4. Publishes a v<tag> git tag + Gitea release (digest, toolchain, upstream
|
||||
# highlights, deployment caveats) for every image tag without one.
|
||||
#
|
||||
# This workflow NEVER pushes or moves `latest`, and never re-pushes an
|
||||
# existing tag: every upgrade of the running deployment is a deliberate
|
||||
@@ -18,13 +21,19 @@ name: Sync upstream and build images
|
||||
on:
|
||||
schedule:
|
||||
- cron: '17 */6 * * *'
|
||||
workflow_dispatch: {}
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: Build this exact dsh version too (e.g. 0.1.5-alpha.2); latest/next are always considered
|
||||
required: false
|
||||
default: ''
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- Dockerfile
|
||||
- web.cordis.patch.yml
|
||||
- .gitea/workflows/sync-upstream.yml
|
||||
- .gitea/scripts/publish-releases.js
|
||||
|
||||
env:
|
||||
UPSTREAM: https://github.com/deepseek-ai/deepseek-harness.git
|
||||
@@ -41,29 +50,32 @@ jobs:
|
||||
with:
|
||||
ref: main
|
||||
|
||||
- name: Mirror upstream refs into this repository
|
||||
# Branch only: upstream's dsh-v* tags are deliberately NOT mirrored, so
|
||||
# this repo's tag list is exclusively its own v<image tag> releases.
|
||||
- name: Mirror upstream master into this repository
|
||||
env:
|
||||
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
set -eux
|
||||
git clone --bare "$UPSTREAM" /tmp/upstream
|
||||
git clone --bare --single-branch --branch master "$UPSTREAM" /tmp/upstream
|
||||
cd /tmp/upstream
|
||||
git remote add mirror "https://oauth2:${TOKEN}@${REGISTRY}/${IMAGE}.git"
|
||||
git push mirror '+refs/heads/master:refs/heads/master'
|
||||
git push mirror '+refs/tags/dsh-v*:refs/tags/dsh-v*'
|
||||
|
||||
- name: Plan builds (new dsh version + pinned-version freshness)
|
||||
- name: Plan builds (new dsh versions + pinned-version freshness)
|
||||
id: plan
|
||||
env:
|
||||
TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
||||
REQUESTED: ${{ inputs.version }}
|
||||
run: |
|
||||
set -eu
|
||||
DSH_LATEST=$(npm view @deepseek-ai/dsh@latest version)
|
||||
PNPM_LATEST=$(npm view pnpm@latest version)
|
||||
DSH_LATEST=$(npm view @deepseek-ai/dsh dist-tags.latest)
|
||||
DSH_NEXT=$(npm view @deepseek-ai/dsh dist-tags.next || true)
|
||||
PNPM_LATEST=$(npm view pnpm dist-tags.latest)
|
||||
PINNED=$(sed -n 's/^ARG DSH_VERSION=//p' Dockerfile | head -1)
|
||||
docker pull -q "$BASE_IMAGE" > /dev/null
|
||||
BASE_DIGEST=$(docker inspect --format '{{index .RepoDigests 0}}' "$BASE_IMAGE")
|
||||
echo "dsh latest=$DSH_LATEST pinned=$PINNED pnpm=$PNPM_LATEST base=$BASE_DIGEST"
|
||||
echo "dsh latest=$DSH_LATEST next=$DSH_NEXT requested='$REQUESTED' pinned=$PINNED pnpm=$PNPM_LATEST base=$BASE_DIGEST"
|
||||
|
||||
ACCEPT='application/vnd.oci.image.index.v1+json,application/vnd.docker.distribution.manifest.list.v2+json,application/vnd.oci.image.manifest.v1+json,application/vnd.docker.distribution.manifest.v2+json'
|
||||
tag_exists() {
|
||||
@@ -85,16 +97,21 @@ jobs:
|
||||
}
|
||||
|
||||
BUILDS=""
|
||||
# 1. New official release the registry lacks -> new version tag.
|
||||
if ! tag_exists "$DSH_LATEST"; then
|
||||
BUILDS="$DSH_LATEST=$DSH_LATEST"
|
||||
fi
|
||||
# 2. Pinned version: missing entirely -> build it; otherwise compare
|
||||
# the newest existing build's toolchain labels and cut a -rN
|
||||
# revision when pnpm or the base image moved.
|
||||
if [ "$PINNED" != "$DSH_LATEST" ] && ! tag_exists "$PINNED"; then
|
||||
# 1. Every candidate release the registry lacks -> new version tag.
|
||||
# Candidates: npm `latest`, npm `next`, and an explicitly requested
|
||||
# version (alphas are only built on request).
|
||||
for V in $(printf '%s\n%s\n%s\n' "$DSH_LATEST" "$DSH_NEXT" "$REQUESTED" | grep -v '^$' | sort -u); do
|
||||
if ! tag_exists "$V"; then
|
||||
BUILDS="$BUILDS $V=$V"
|
||||
fi
|
||||
done
|
||||
# 2. Pinned version: build it if missing; otherwise compare the newest
|
||||
# existing build's toolchain labels and cut a -rN revision when
|
||||
# pnpm or the base image moved.
|
||||
case " $BUILDS " in *" $PINNED=$PINNED "*) PINNED_PLANNED=1;; *) PINNED_PLANNED="";; esac
|
||||
if [ -z "$PINNED_PLANNED" ] && ! tag_exists "$PINNED"; then
|
||||
BUILDS="$BUILDS $PINNED=$PINNED"
|
||||
elif tag_exists "$PINNED"; then
|
||||
elif [ -z "$PINNED_PLANNED" ]; then
|
||||
NEWEST=$(curl -s -H "Authorization: token ${TOKEN}" \
|
||||
"https://${REGISTRY}/api/v1/packages/${{ github.repository_owner }}?type=container&q=deepseek-harness&limit=100" \
|
||||
| tr ',' '\n' | sed -n 's/.*"version": *"\([^"]*\)".*/\1/p' \
|
||||
@@ -120,9 +137,12 @@ jobs:
|
||||
TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
||||
PNPM_VERSION: ${{ steps.plan.outputs.pnpm }}
|
||||
BASE_DIGEST: ${{ steps.plan.outputs.base_digest }}
|
||||
CI_RUN: ${{ github.run_number }}
|
||||
run: |
|
||||
set -eux
|
||||
echo "$TOKEN" | docker login "$REGISTRY" -u "${{ github.repository_owner }}" --password-stdin
|
||||
GIT_SHA=$(git rev-parse HEAD)
|
||||
BUILD_DATE=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
||||
for entry in ${{ steps.plan.outputs.builds }}; do
|
||||
TAG=${entry%%=*}
|
||||
VER=${entry#*=}
|
||||
@@ -131,6 +151,9 @@ jobs:
|
||||
--build-arg "DSH_VERSION=${VER}" \
|
||||
--build-arg "PNPM_VERSION=${PNPM_VERSION}" \
|
||||
--build-arg "BASE_DIGEST=${BASE_DIGEST}" \
|
||||
--build-arg "GIT_SHA=${GIT_SHA}" \
|
||||
--build-arg "CI_RUN=${CI_RUN}" \
|
||||
--build-arg "BUILD_DATE=${BUILD_DATE}" \
|
||||
-t "$REF" .
|
||||
|
||||
# Smoke: versions match, and the web server actually boots with
|
||||
@@ -166,92 +189,20 @@ jobs:
|
||||
done
|
||||
|
||||
# Every image tag in the registry gets a matching v<tag> git tag + Gitea
|
||||
# release on main (the Dockerfile state that built it). Idempotent: only
|
||||
# tags without a release are published, so this also backfills.
|
||||
# release with digest, toolchain, upstream highlights and deployment
|
||||
# caveats. Idempotent (only tags without a release are published), and it
|
||||
# runs on the image base so the script needs nothing from the runner.
|
||||
- name: Publish releases for image tags without one
|
||||
env:
|
||||
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
REG_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
||||
OWNER: ${{ github.repository_owner }}
|
||||
REPO: ${{ github.repository }}
|
||||
RUN_NUMBER: ${{ github.run_number }}
|
||||
run: |
|
||||
set -eu
|
||||
API="https://${REGISTRY}/api/v1"
|
||||
MAIN_SHA=$(git rev-parse HEAD)
|
||||
json_escape() { sed -e 's/\\/\\\\/g' -e 's/"/\\"/g' | awk '{printf "%s\\n", $0}'; }
|
||||
|
||||
TAGS=$(curl -s -H "Authorization: token ${REG_TOKEN}" \
|
||||
"$API/packages/${OWNER}?type=container&q=deepseek-harness&limit=100" \
|
||||
| tr ',' '\n' | sed -n 's/.*"version": *"\([^"]*\)".*/\1/p' | grep -v '^sha256:' | sort -V)
|
||||
|
||||
for TAG in $TAGS; do
|
||||
REL="v${TAG}"
|
||||
CODE=$(curl -s -o /dev/null -w '%{http_code}' -H "Authorization: token ${TOKEN}" "$API/repos/${REPO}/releases/tags/${REL}")
|
||||
[ "$CODE" = 404 ] || { echo "$REL: release exists"; continue; }
|
||||
echo "$REL: publishing"
|
||||
|
||||
DIGEST=$(curl -sI -u "${OWNER}:${REG_TOKEN}" \
|
||||
-H 'Accept: application/vnd.docker.distribution.manifest.v2+json,application/vnd.oci.image.manifest.v1+json' \
|
||||
"https://${REGISTRY}/v2/${IMAGE}/manifests/${TAG}" | grep -i '^docker-content-digest' | awk '{print $2}' | tr -d '\r')
|
||||
MAN=$(curl -s -u "${OWNER}:${REG_TOKEN}" \
|
||||
-H 'Accept: application/vnd.docker.distribution.manifest.v2+json,application/vnd.oci.image.manifest.v1+json' \
|
||||
"https://${REGISTRY}/v2/${IMAGE}/manifests/${TAG}")
|
||||
CFG=$(printf '%s' "$MAN" | grep -o '"digest": *"sha256:[a-f0-9]*"' | head -1 | grep -o 'sha256:[a-f0-9]*' || true)
|
||||
BLOB=$([ -n "$CFG" ] && curl -s -u "${OWNER}:${REG_TOKEN}" "https://${REGISTRY}/v2/${IMAGE}/blobs/$CFG" || echo '{}')
|
||||
PNPMV=$(printf '%s' "$BLOB" | grep -o '"dev.milesward.pnpm-version":"[^"]*"' | cut -d'"' -f4 || true)
|
||||
BASEV=$(printf '%s' "$BLOB" | grep -o '"dev.milesward.base-digest":"[^"]*"' | cut -d'"' -f4 || true)
|
||||
VER=$(printf '%s' "$TAG" | sed 's/-r[0-9]*$//')
|
||||
PRE=false; case "$VER" in *alpha*) PRE=true;; esac
|
||||
case "$TAG" in
|
||||
*-r[0-9]*) KIND="Toolchain refresh of dsh ${VER}: same upstream release, rebuilt with the current pnpm and a freshly patched \`node:22-bookworm-slim\` base."
|
||||
TITLE="${REL} — dsh ${VER} toolchain refresh (pnpm ${PNPMV:-?})";;
|
||||
*) KIND="Container build of **DeepSeek Harness (dsh) ${VER}** from the official npm release, built and smoke-tested by CI."
|
||||
TITLE="${REL} — dsh ${VER} · pnpm ${PNPMV:-?} · node 22";;
|
||||
esac
|
||||
case "$VER" in
|
||||
0.1.0*|0.1.1*) TOKEN_NOTE="";;
|
||||
*) TOKEN_NOTE="> **Launch-token auth (dsh 0.1.2+):** the Web UI requires a one-time token printed in \`docker logs\`; it rotates on every restart and is exchanged for a ~30-day cookie bound to the origin you open it on. \`@goodandready/dsh-lanmode\` ≤0.6.8 is incompatible with this line.";;
|
||||
esac
|
||||
|
||||
# Body assembled line-by-line (a heredoc's column-0 lines would
|
||||
# terminate this YAML block scalar).
|
||||
BODY=$(printf '%s\n' \
|
||||
"${KIND}" \
|
||||
"" \
|
||||
'```' \
|
||||
"docker pull gitea.milesward.dev/mward4/deepseek-harness:${TAG}" \
|
||||
'```' \
|
||||
"" \
|
||||
"### What's inside" \
|
||||
"" \
|
||||
"| | |" \
|
||||
"|---|---|" \
|
||||
"| dsh | \`${VER}\` — [upstream release notes](https://github.com/deepseek-ai/deepseek-harness/releases/tag/dsh-v${VER}) |" \
|
||||
"| pnpm | \`${PNPMV:-unknown}\` |" \
|
||||
"| base image | \`${BASEV:-unknown}\` |" \
|
||||
"| image digest | \`${DIGEST}\` |" \
|
||||
"| built from | \`main@${MAIN_SHA}\` (published by CI run #${RUN_NUMBER}) |" \
|
||||
"" \
|
||||
"### Deploy on Unraid" \
|
||||
"" \
|
||||
"- **Repository:** \`gitea.milesward.dev/mward4/deepseek-harness:${TAG}\`" \
|
||||
"- **Post Arguments** (replace the image command entirely): \`web --patch /opt/deepseek-harness/web.cordis.patch.yml --no-open --trusted-host <host> [--trusted-host <host2>]\`" \
|
||||
"- First run: \`chown -R 1000:1000 /mnt/user/appdata/deepseek-harness\`" \
|
||||
"" \
|
||||
"${TOKEN_NOTE}" \
|
||||
"" \
|
||||
"Image tags are immutable — this release will never be rebuilt or moved. See the [README](https://gitea.milesward.dev/mward4/deepseek-harness#versions-and-upgrades) for the upgrade procedure.")
|
||||
BODY_JSON=$(printf '%s' "$BODY" | json_escape)
|
||||
|
||||
# Tag main at the commit that built the image (ignore "already exists").
|
||||
curl -s -o /dev/null -w "tag ${REL}: HTTP %{http_code}\n" -X POST \
|
||||
-H "Authorization: token ${TOKEN}" -H 'Content-Type: application/json' \
|
||||
"$API/repos/${REPO}/tags" \
|
||||
-d "{\"tag_name\":\"${REL}\",\"target\":\"${MAIN_SHA}\",\"message\":\"deepseek-harness image ${TAG}\"}"
|
||||
curl -s -o /tmp/rel.json -w "release ${REL}: HTTP %{http_code}\n" -X POST \
|
||||
-H "Authorization: token ${TOKEN}" -H 'Content-Type: application/json' \
|
||||
"$API/repos/${REPO}/releases" \
|
||||
-d "{\"tag_name\":\"${REL}\",\"target_commitish\":\"${MAIN_SHA}\",\"name\":\"${TITLE}\",\"body\":\"${BODY_JSON}\",\"draft\":false,\"prerelease\":${PRE}}"
|
||||
grep -q '"id"' /tmp/rel.json || { echo "::error::release creation failed for ${REL}"; cat /tmp/rel.json; exit 1; }
|
||||
done
|
||||
docker run --rm -i \
|
||||
-e "GITEA=https://${REGISTRY}" -e OWNER -e REPO -e IMAGE -e GITEA_TOKEN -e REG_TOKEN \
|
||||
-e "MAIN_SHA=${MAIN_SHA}" -e RUN_NUMBER \
|
||||
"$BASE_IMAGE" node - < .gitea/scripts/publish-releases.js
|
||||
+9
-1
@@ -56,16 +56,24 @@ ARG DSH_VERSION
|
||||
ARG PNPM_VERSION
|
||||
# BASE_DIGEST: resolved digest of the FROM image at build time; the scheduled
|
||||
# freshness check compares it (and pnpm-version) against current releases.
|
||||
# GIT_SHA / CI_RUN / BUILD_DATE: build provenance, read back by the release
|
||||
# publisher so each release points at the commit that actually built it.
|
||||
ARG BASE_DIGEST=""
|
||||
ARG GIT_SHA=""
|
||||
ARG CI_RUN=""
|
||||
ARG BUILD_DATE=""
|
||||
LABEL org.opencontainers.image.title="deepseek-harness" \
|
||||
org.opencontainers.image.description="DeepSeek Harness (dsh) web UI, built from the official npm release" \
|
||||
org.opencontainers.image.version="${DSH_VERSION}" \
|
||||
org.opencontainers.image.revision="${GIT_SHA}" \
|
||||
org.opencontainers.image.created="${BUILD_DATE}" \
|
||||
org.opencontainers.image.source="https://gitea.milesward.dev/mward4/deepseek-harness" \
|
||||
org.opencontainers.image.url="https://github.com/deepseek-ai/deepseek-harness" \
|
||||
org.opencontainers.image.licenses="MIT" \
|
||||
dev.milesward.dsh-version="${DSH_VERSION}" \
|
||||
dev.milesward.pnpm-version="${PNPM_VERSION}" \
|
||||
dev.milesward.base-digest="${BASE_DIGEST}"
|
||||
dev.milesward.base-digest="${BASE_DIGEST}" \
|
||||
dev.milesward.ci-run="${CI_RUN}"
|
||||
|
||||
ENTRYPOINT ["dsh"]
|
||||
# --patch must come immediately after `web` (launcher flag), --no-open so a
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
|
||||
<p align="center">
|
||||
<img alt="pinned" src="https://img.shields.io/badge/deployed-0.1.1--rc.2-4d6bfe" />
|
||||
<img alt="newest" src="https://img.shields.io/badge/newest%20build-0.1.5--rc.1-2874d7" />
|
||||
<img alt="newest" src="https://img.shields.io/gitea/v/release/mward4/deepseek-harness?gitea_url=https%3A%2F%2Fgitea.milesward.dev&include_prereleases&sort=semver&label=newest%20build&color=2874d7" />
|
||||
<img alt="tags" src="https://img.shields.io/badge/tags-immutable%20%C2%B7%20no%20%3Alatest-59824f" />
|
||||
<img alt="ci" src="https://img.shields.io/badge/CI-Gitea%20Actions%20%C2%B7%20every%206h-609926?logo=gitea&logoColor=white" />
|
||||
<img alt="ci" src="https://gitea.milesward.dev/mward4/deepseek-harness/actions/workflows/sync-upstream.yml/badge.svg?branch=main" />
|
||||
<img alt="base" src="https://img.shields.io/badge/base-node%2022%20%C2%B7%20bookworm--slim-339933?logo=node.js&logoColor=white" />
|
||||
<img alt="license" src="https://img.shields.io/badge/license-MIT-330f1f" />
|
||||
</p>
|
||||
@@ -34,7 +34,7 @@ without ever changing what a running deployment executes.
|
||||
|
||||
> **Status.** The deployed version is pinned to **`0.1.1-rc.2`**. Newer upstream
|
||||
> releases are built and published automatically as their own tags (currently up to
|
||||
> `0.1.5-rc.1`) but nothing moves until the template is edited by hand — see
|
||||
> `0.1.5-rc.2`) but nothing moves until the template is edited by hand — see
|
||||
> [Versions and upgrades](#versions-and-upgrades) for why, and for what changed in
|
||||
> `0.1.2+` before you jump.
|
||||
|
||||
@@ -101,10 +101,13 @@ Three things went wrong with the alternatives, and this repo is shaped by each:
|
||||
`dsh plugin --profile web add|update|remove` runs via `docker exec`.
|
||||
|
||||
#### Operations
|
||||
- **Upstream mirror.** The `master` branch and every `dsh-v*` tag track GitHub exactly,
|
||||
synced every six hours.
|
||||
- **Releases.** Every image tag gets a matching `v<tag>` [release](../../releases) with
|
||||
its digest, toolchain versions, and deployment notes — generated by CI.
|
||||
- **Upstream mirror.** The `master` branch tracks GitHub's `master` exactly, synced every
|
||||
six hours. (Upstream's own `dsh-v*` tags are deliberately not mirrored — this repo's
|
||||
tag list is exclusively its image releases; each release links to the upstream tag.)
|
||||
- **Releases.** Every image tag gets a matching `v<tag>` [release](../../releases) —
|
||||
digest, toolchain versions, the upstream release's English highlights, and the
|
||||
deployment caveats that apply to that version — generated by CI from the image's own
|
||||
provenance labels.
|
||||
- **Forensic validation workflow.** A manual job that diffs any third-party
|
||||
`deepseek-harness` image on the host against the trusted build without executing it.
|
||||
|
||||
@@ -224,7 +227,8 @@ Two rules about the command line that are easy to get wrong:
|
||||
|---|---|---|
|
||||
| `0.1.1-rc.2` | 0.1.1-rc.2 | **Pinned / deployed.** No launch-token auth; `dsh-lanmode` compatible. |
|
||||
| `0.1.2-rc.1` | 0.1.2-rc.1 | First launch-token release; Remote gateway replaces the ApiProxy. |
|
||||
| `0.1.5-rc.1` | 0.1.5-rc.1 | Current upstream `latest`. Session format V3 — **no downgrade** once migrated. |
|
||||
| `0.1.5-rc.1` | 0.1.5-rc.1 | Upstream npm `latest`. Session format V3 — **no downgrade** once migrated. |
|
||||
| `0.1.5-rc.2` | 0.1.5-rc.2 | Upstream npm `next`. Feedback-dialog and file-card refinements on top of rc.1. |
|
||||
|
||||
The full list, with digests and notes, is on the [Releases](../../releases) page — one
|
||||
release per image tag, published by CI.
|
||||
@@ -293,14 +297,19 @@ container as the agent**. Everything below follows from that.
|
||||
[`sync-upstream.yml`](.gitea/workflows/sync-upstream.yml) runs on the Gitea Actions
|
||||
runners every six hours (`17 */6 * * *`) and on any change to the build inputs:
|
||||
|
||||
1. **Mirror** — force-syncs upstream `master` and every `dsh-v*` tag into this repo.
|
||||
2. **New releases** — if npm's `latest` for `@deepseek-ai/dsh` has no tag in the registry,
|
||||
builds it, smoke-tests it, pushes it.
|
||||
1. **Mirror** — force-syncs upstream `master` into this repo's `master`.
|
||||
2. **New releases** — for each `@deepseek-ai/dsh` version npm publishes as `latest` or
|
||||
`next` (release candidates; alphas only when asked for) that has no tag in the
|
||||
registry: build, smoke-test, push. A manual run can name any exact version.
|
||||
3. **Freshness** — reads the toolchain labels off the newest build of the pinned version
|
||||
and compares them to the current pnpm release and `node:22-bookworm-slim` digest. If
|
||||
either moved, publishes `<version>-r<run>` with the updated toolchain.
|
||||
4. **Releases** — every image tag without a `v<tag>` release gets one, pointing at the
|
||||
`main` commit that built it, with digest, toolchain, and deployment notes.
|
||||
4. **Releases** — every image tag without a `v<tag>` release gets one, tagged at the
|
||||
`main` commit recorded in the image's `org.opencontainers.image.revision` label, with
|
||||
digest and toolchain, the upstream release's English notes, and the caveats that apply
|
||||
to that version (launch token from `0.1.2`, session-format migration from `0.1.5`).
|
||||
Generated by [`publish-releases.js`](.gitea/scripts/publish-releases.js), which runs
|
||||
on the image's own Node base so the runner needs nothing installed.
|
||||
|
||||
Nothing in this pipeline can change an existing tag or publish `latest`. Adopting any
|
||||
new build — release or revision — is a template edit.
|
||||
@@ -322,14 +331,17 @@ the official release, upstream safety check intact, no tampering.
|
||||
|
||||
| Branch / path | Contents |
|
||||
|---|---|
|
||||
| `master` | Exact mirror of upstream `master` plus all `dsh-v*` tags. Never edited here. |
|
||||
| `master` | Exact mirror of upstream `master`. Never edited here. |
|
||||
| `main` | This branch — the build. |
|
||||
| `Dockerfile` | The image. `ARG DSH_VERSION` is the pinned default. |
|
||||
| `web.cordis.patch.yml` | The `0.0.0.0` bind patch, applied via `--patch`. |
|
||||
| `.gitea/workflows/` | `sync-upstream.yml` (mirror · build · freshness · releases), `validate-suspect-image.yml` (forensics). |
|
||||
| `.gitea/scripts/` | `publish-releases.js` — the release generator. |
|
||||
| `assets/` | Logo (transparent PNG, also the Unraid template icon). |
|
||||
|
||||
Release tags on `main` are `v<image tag>`; upstream's mirrored tags are `dsh-v<version>`.
|
||||
Every tag on this repo is a `v<image tag>` release pointing at the `main` commit that
|
||||
built the image. Upstream's source tags live on GitHub (`dsh-v<version>`) and are linked
|
||||
from each release.
|
||||
|
||||
## License
|
||||
|
||||
|
||||
Reference in new issue
Block a user