diff --git a/.woodpecker/canary.yaml b/.woodpecker/canary.yaml new file mode 100644 index 000000000..98de25331 --- /dev/null +++ b/.woodpecker/canary.yaml @@ -0,0 +1,51 @@ +# Canary judge: check the release the canary is running, then promote it, pick +# up a newer `next`, or roll it back. Every fifteen minutes, and on demand. +# +# Requires repo secrets canary_url, canary_token and deploy_token (the registry +# credentials the `-latest` re-tagging needs). canary_window is optional. +# Shell-side references are written $$name (see the note in deploy.yaml). +# +# Written to fail loudly when canary_url is missing: the schedule only exists +# because the maintainer asked for one, so a canary nobody configured is a +# misconfiguration, not a quiet skip. + +when: + - event: [cron] + - event: [manual] + +# A judging run takes longer than the interval when the canary is unhealthy; +# overlapping runs would judge the same release twice. +concurrency: 1 + +steps: + - name: judge + image: golang:1.27.3-bookworm + environment: + CANARY_URL: + from_secret: canary_url + CANARY_WINDOW: + from_secret: canary_window + ARCHIE_CANARY_TOKEN: + from_secret: canary_token + DEPLOY_TOKEN: + from_secret: deploy_token + commands: + - '[ -n "$$CANARY_URL" ] || { echo "repo secret canary_url is not set, so there is no canary to judge"; exit 1; }' + - '[ -n "$$ARCHIE_CANARY_TOKEN" ] || { echo "repo secret canary_token is not set, so the canary cannot be reached"; exit 1; }' + - '[ -n "$$DEPLOY_TOKEN" ] || { echo "repo secret deploy_token is not set, so the registry cannot be tagged"; exit 1; }' + - go build -tags no_ui -o /tmp/archied ./cmd/archied + # archied reads the registry credentials a docker login would have + # written; this step has no docker CLI, so the file is written directly. + - | + set -eu + mkdir -p "$$HOME/.docker" + auth=$(printf '%s:%s' "$$CI_REPO_OWNER" "$$DEPLOY_TOKEN" | base64 -w0) + printf '{"auths":{"git.catlow.cloud":{"auth":"%s"}}}\n' "$$auth" > "$$HOME/.docker/config.json" + - | + set -eu + set -- + if [ -n "$$CANARY_WINDOW" ]; then + set -- -window "$$CANARY_WINDOW" + fi + /tmp/archied release canary check -dashboard "$$CANARY_URL" "$$@" \ + -latest git.catlow.cloud/sam/archied,git.catlow.cloud/sam/archie-agent diff --git a/.woodpecker/deploy.yaml b/.woodpecker/deploy.yaml new file mode 100644 index 000000000..16819776f --- /dev/null +++ b/.woodpecker/deploy.yaml @@ -0,0 +1,333 @@ +# Publish pipeline: a push to main builds the edge images, a v* tag also cuts a +# signed release. The release workflow pushes main and the tag in one command, +# so both events are delivered for the same commit; `plan` decides which +# pipeline does the work and the other one skips. +# +# Requires repo secrets: deploy_token (pushes images, publishes the Gitea +# release, links the packages) and release_signing_key (the ed25519 seed the +# release statement is signed with). canary_url and canary_token are optional; +# without them the canary install is skipped. +# +# Every shell-side reference is written $$name, which arrives at the shell as +# $name. Woodpecker rewrites only the braced form: ${name} is substituted before +# the shell runs, and an operator inside it is dropped, so ${version:-none} +# becomes empty instead of defaulting. The escaped form is used everywhere so the +# rule is mechanical rather than a judgement per line. + +when: + - event: push + branch: [main] + - event: tag + ref: refs/tags/v* + +# Two deployments at once would race on the released tags and on `latest`. +concurrency: 1 + +variables: + # The gate and the distribution step both build the dashboard. Anchored here + # rather than written twice, so the digest and the pnpm version can only + # change in one place. + - &node-setup | + set -eu + apt-get update -qq + apt-get install -y -qq --no-install-recommends xz-utils + curl -fsSL -o /tmp/node.tar.xz https://nodejs.org/dist/v24.22.2/node-v24.22.2-linux-x64.tar.xz + echo "48cc0e21e048790e54c0cf5749c2725005313d652651c40b7a21feb9697aaf75 /tmp/node.tar.xz" | sha256sum -c - + tar -xJf /tmp/node.tar.xz -C /usr/local --strip-components=1 + # pnpm's version belongs to the lockfile; installing any other one makes + # `pnpm install --frozen-lockfile` reject the tree. + npm install -g "pnpm@$(node -p 'require("./ui/package.json").packageManager.split("@")[1]')" + +clone: + git: + image: woodpeckerci/plugin-git:2.8.0 + settings: + # A tag pipeline must see the tag it is building, and a branch pipeline + # must see a tag pointing at HEAD to know the tag pipeline owns it. + tags: true + fetch_target_branch: true + +steps: + - name: plan + image: alpine:3 + commands: + - apk add --no-cache git + - | + set -eu + # An annotated tag makes CI_COMMIT_SHA the tag object, so the commit is + # resolved from the ref: image tags and the release statement pin it. + sha=$(git rev-parse "$$CI_COMMIT_REF^{commit}") + version=$(git tag --points-at HEAD --list 'v*' | sed -e 's|^v||' | sort -V | tail -1) + run=true + case "$$CI_PIPELINE_EVENT" in + tag) ;; + *) [ -z "$$version" ] || run=false ;; + esac + { + echo "COMMIT_SHA=$$sha" + echo "RELEASE_VERSION=$$version" + echo "RUN=$$run" + } > "$$CI_WORKSPACE/.git/ci-plan.env" + echo "commit $$sha, release $${version:-none}, run $$run" + + - name: gate + image: golang:1.27.3-bookworm + depends_on: [plan] + # The full test suite starts containers. It drives the host daemon through + # the Go client, so the socket is enough - this step needs no docker CLI. + # The one test that needs the daemon binds a temporary directory into the + # container it starts, so that directory has to exist at the same path on + # the host; TMPDIR points the test at it. + volumes: + - /var/run/docker.sock:/var/run/docker.sock + - /var/tmp/woodpecker-archie-gate:/var/tmp/woodpecker-archie-gate + environment: + DOCKER_HOST: unix:///var/run/docker.sock + TMPDIR: /var/tmp/woodpecker-archie-gate + commands: + - '. "$$CI_WORKSPACE/.git/ci-plan.env"' + - '[ "$$RUN" = true ] || { echo "a release tag owns this commit; the tag pipeline publishes it"; exit 0; }' + - go install github.com/go-task/task/v3/cmd/task@v3.48.0 + - go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(cat .golangci-version) + - go install mvdan.cc/gofumpt@v0.11.0 + - bash tools/proto.sh install + - *node-setup + - | + set -eu + if ! git show-ref --verify --quiet refs/heads/main; then + if git rev-parse --verify --quiet origin/main >/dev/null; then + git branch main origin/main + else + # A tag pipeline clones the tag alone. HEAD is the released commit, + # which was on main, so the contract baseline is that same tree. + echo "no origin/main in this clone; using the released commit as the contract baseline" + git branch main HEAD + fi + fi + - task check TEST_FLAGS=-count=1 + - git diff --exit-code + - go install golang.org/x/vuln/cmd/govulncheck@latest + - govulncheck ./... + - | + set -eu + fail=0 + for tag in $(git tag --points-at HEAD); do + case "$$tag" in + v*) + ver=$(echo "$$tag" | sed -e 's|^v||') + echo " release tag $$tag -> looking for [$$ver] in CHANGELOG.md" + grep -q "^## \[$$ver\]" CHANGELOG.md || { + echo " FAIL: CHANGELOG.md has no [$$ver] section" + fail=1 + } + ;; + esac + done + if [ $$fail -ne 0 ]; then + echo + echo "A release tag points at this commit but its changelog does not" + echo "describe that version. Cut releases with the release workflow." + exit 1 + fi + if ! git tag --points-at HEAD | grep -qE '^v[0-9]'; then + echo "This commit isn't a release, so the images are published as :edge and sha-; :latest keeps naming the newest promoted release." + fi + + - name: archied-image + image: docker:29-cli + depends_on: [gate] + volumes: + - /var/run/docker.sock:/var/run/docker.sock + environment: + DOCKER_HOST: unix:///var/run/docker.sock + DEPLOY_TOKEN: + from_secret: deploy_token + commands: + - '. "$$CI_WORKSPACE/.git/ci-plan.env"' + - '[ "$$RUN" = true ] || { echo "skipped: the tag pipeline publishes this commit"; exit 0; }' + - '[ -n "$$DEPLOY_TOKEN" ] || { echo "repo secret deploy_token is not set"; exit 1; }' + - printf '%s' "$$DEPLOY_TOKEN" | docker login git.catlow.cloud -u "$$CI_REPO_OWNER" --password-stdin + - | + set -eu + # A release reports its version; anything else is a build of main and + # says so, so a running binary can always name its commit. + if [ -n "$$RELEASE_VERSION" ]; then + component=$$RELEASE_VERSION + else + component="dev+$(echo "$$COMMIT_SHA" | cut -c1-12)" + fi + set -- \ + --tag "git.catlow.cloud/sam/archied:edge" \ + --tag "git.catlow.cloud/sam/archied:sha-$$COMMIT_SHA" + if [ -n "$$RELEASE_VERSION" ]; then + set -- "$$@" --tag "git.catlow.cloud/sam/archied:v$$RELEASE_VERSION" + fi + # No cache flags: the agent's daemon keeps its layer cache between + # pipelines, which is what type=gha bought on ephemeral runners. + docker buildx build --push --file Dockerfile.archied \ + --build-arg GATEWAY_VERSION="$$component" \ + --build-arg RUNTIME_VERSION="$$component" \ + --provenance=false \ + "$$@" . + + - name: agent-image + image: docker:29-cli + depends_on: [gate] + volumes: + - /var/run/docker.sock:/var/run/docker.sock + environment: + DOCKER_HOST: unix:///var/run/docker.sock + DEPLOY_TOKEN: + from_secret: deploy_token + commands: + - '. "$$CI_WORKSPACE/.git/ci-plan.env"' + - '[ "$$RUN" = true ] || { echo "skipped: the tag pipeline publishes this commit"; exit 0; }' + - '[ -n "$$RELEASE_VERSION" ] || { echo "not a release; the agent image is only published with a release"; exit 0; }' + - '[ -n "$$DEPLOY_TOKEN" ] || { echo "repo secret deploy_token is not set"; exit 1; }' + - printf '%s' "$$DEPLOY_TOKEN" | docker login git.catlow.cloud -u "$$CI_REPO_OWNER" --password-stdin + - | + set -eu + apk add --no-cache jq + docker buildx build --push --file Dockerfile \ + --build-arg RUNTIME_VERSION="$$RELEASE_VERSION" \ + --tag "git.catlow.cloud/sam/archie-agent:v$$RELEASE_VERSION" \ + --tag "git.catlow.cloud/sam/archie-agent:sha-$$COMMIT_SHA" \ + --provenance=false \ + --metadata-file "$$CI_WORKSPACE/.git/agent-image.json" \ + . + # The release statement pins the agent image by digest, so the digest is + # what the distribution records, not the tag. + jq -er '."containerimage.digest"' "$$CI_WORKSPACE/.git/agent-image.json" \ + > "$$CI_WORKSPACE/.git/agent-image.digest" + echo "agent image $(cat "$$CI_WORKSPACE/.git/agent-image.digest")" + + - name: dist + image: golang:1.27.3-bookworm + depends_on: [archied-image, agent-image] + commands: + - '. "$$CI_WORKSPACE/.git/ci-plan.env"' + - '[ "$$RUN" = true ] || { echo "skipped: the tag pipeline publishes this commit"; exit 0; }' + - '[ -n "$$RELEASE_VERSION" ] || { echo "not a release; no distribution to build"; exit 0; }' + - apt-get update -qq + - apt-get install -y -qq --no-install-recommends jq zip + - *node-setup + # A subshell: a bare `cd ui` here would leave every later command in this + # step building from the dashboard directory. + - | + set -eu + ( + cd ui + pnpm install --frozen-lockfile + pnpm run build + ) + - | + set -eu + base=github.com/samcharles93/archie-core + ldflags="-X $${base}/internal/installtype.buildType=binary -X $${base}/internal/buildinfo.Version=$$RELEASE_VERSION -X $${base}/internal/buildinfo.Runtime=$$RELEASE_VERSION -X $${base}/internal/app/agentworker.version=$$RELEASE_VERSION" + cmds=$(jq -r '.required_topology.units[], .required_topology.binaries[]?' release.json) + mkdir -p dist + for cmd in $$cmds; do + GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "$$ldflags" -o "dist/$$cmd" "./cmd/$$cmd" + done + name="archie-core-archied-v$$RELEASE_VERSION-linux-amd64" + mkdir -p "$$name" + for cmd in $$cmds; do + cp "dist/$$cmd" "$$name/" + done + cp deployments/INSTRUCTIONS.md CHANGELOG.md "$$name/" + if [ -f README.md ]; then cp README.md "$$name/"; fi + digest=$(cat "$$CI_WORKSPACE/.git/agent-image.digest") + test -n "$$digest" + jq --arg image "git.catlow.cloud/sam/archie-agent@$$digest" '. + {agent_image: $$image}' \ + release.json > "$$name/release.json" + zip -qr "$$name.zip" "$$name" + echo "RELEASE_ZIP=$$name.zip" >> "$$CI_WORKSPACE/.git/ci-plan.env" + echo "built $$name.zip" + + - name: publish + image: golang:1.27.3-bookworm + depends_on: [dist] + environment: + DEPLOY_TOKEN: + from_secret: deploy_token + ARCHIE_RELEASE_SEED: + from_secret: release_signing_key + commands: + - '. "$$CI_WORKSPACE/.git/ci-plan.env"' + - '[ "$$RUN" = true ] || { echo "skipped: the tag pipeline publishes this commit"; exit 0; }' + - '[ -n "$$RELEASE_VERSION" ] || { echo "not a release; nothing to publish"; exit 0; }' + - '[ -n "$$ARCHIE_RELEASE_SEED" ] || { echo "repo secret release_signing_key is not set"; exit 1; }' + # archied pushes the release artifact with oras, which reads the registry + # credentials a docker login would have written. + - | + set -eu + mkdir -p "$$HOME/.docker" + auth=$(printf '%s:%s' "$$CI_REPO_OWNER" "$$DEPLOY_TOKEN" | base64 -w0) + printf '{"auths":{"git.catlow.cloud":{"auth":"%s"}}}\n' "$$auth" > "$$HOME/.docker/config.json" + - | + set -eu + prerelease=false + case "$$RELEASE_VERSION" in *-*) prerelease=true ;; esac + digest=$(cat "$$CI_WORKSPACE/.git/agent-image.digest") + ./dist/archied release publish -source git.catlow.cloud/sam/archie \ + -version "$$RELEASE_VERSION" -prerelease="$$prerelease" \ + -zip "$$RELEASE_ZIP" \ + -agent-image "git.catlow.cloud/sam/archie-agent@$$digest" \ + -changelog "https://git.catlow.cloud/sam/archie/releases/tag/v$$RELEASE_VERSION" + + - name: notes + image: golang:1.27.3-bookworm + depends_on: [dist] + environment: + DEPLOY_TOKEN: + from_secret: deploy_token + commands: + - '. "$$CI_WORKSPACE/.git/ci-plan.env"' + - '[ "$$RUN" = true ] || { echo "skipped: the tag pipeline publishes this commit"; exit 0; }' + - '[ -n "$$RELEASE_VERSION" ] || { echo "not a release; no notes to publish"; exit 0; }' + - '[ -n "$$DEPLOY_TOKEN" ] || { echo "repo secret deploy_token is not set"; exit 1; }' + - apt-get update -qq + - apt-get install -y -qq --no-install-recommends jq + - | + set -eu + tag="v$$RELEASE_VERSION" + notes=$(mktemp) + awk -v hdr="## [$$RELEASE_VERSION]" ' + index($$0, hdr) == 1 { printing = 1 } + printing && /^## \[/ && index($$0, hdr) != 1 { exit } + printing { print } + ' CHANGELOG.md > "$$notes" + if ! [ -s "$$notes" ]; then + echo "no [$$RELEASE_VERSION] section extracted from CHANGELOG.md" >&2 + exit 1 + fi + api=https://git.catlow.cloud/api/v1 + repo=sam/archie + auth="Authorization: token $$DEPLOY_TOKEN" + curl -sf -X DELETE -H "$$auth" "$$api/repos/$$repo/releases/tags/$$tag" >/dev/null || true + curl -sf -X POST -H "$$auth" -H "Content-Type: application/json" \ + -d "$(jq -n --arg tag "$$tag" --arg name "Archie v$$RELEASE_VERSION" --arg body "$(cat "$$notes")" \ + '{tag_name: $$tag, name: $$name, body: $$body, draft: false, prerelease: false}')" \ + "$$api/repos/$$repo/releases" >/dev/null + echo "published release notes for $$tag" + # The packages exist under this repository's namespace but are not + # linked to it, so the package pages stay empty until this runs. + for name in archied archie-agent archie; do + curl -sS -o /dev/null -X POST -H "$$auth" \ + "$$api/packages/sam/container/$$name/-/link/archie" || true + done + + - name: canary + image: golang:1.27.3-bookworm + depends_on: [publish] + environment: + CANARY_URL: + from_secret: canary_url + ARCHIE_CANARY_TOKEN: + from_secret: canary_token + commands: + - '. "$$CI_WORKSPACE/.git/ci-plan.env"' + - '[ "$$RUN" = true ] || { echo "skipped: the tag pipeline publishes this commit"; exit 0; }' + - '[ -n "$$RELEASE_VERSION" ] || { echo "not a release; nothing to install on the canary"; exit 0; }' + - '[ -n "$$CANARY_URL" ] || { echo "canary_url is not set; skipping the canary install"; exit 0; }' + - ./dist/archied release canary start -dashboard "$$CANARY_URL" -version "$$RELEASE_VERSION" diff --git a/.woodpecker/promote.yaml b/.woodpecker/promote.yaml new file mode 100644 index 000000000..386824738 --- /dev/null +++ b/.woodpecker/promote.yaml @@ -0,0 +1,41 @@ +# Manual promotion: move stable to the release the canary is running, without +# waiting for its verdict. Same rules as the canary's own promotion, minus the +# window. +# +# Start it with the pipeline variable VERSION set to the release the canary +# runs (woodpecker-cli pipeline create --branch main --var VERSION=1.57.0). +# +# Requires repo secrets canary_url, canary_token and deploy_token. + +when: + - event: [manual] + +concurrency: 1 + +steps: + - name: promote + image: golang:1.27.3-bookworm + environment: + CANARY_URL: + from_secret: canary_url + ARCHIE_CANARY_TOKEN: + from_secret: canary_token + DEPLOY_TOKEN: + from_secret: deploy_token + commands: + - '[ -n "$$VERSION" ] || { echo "VERSION is empty: start this workflow with the pipeline variable VERSION="; exit 1; }' + - '[ -n "$$CANARY_URL" ] || { echo "repo secret canary_url is not set, so there is no canary to read"; exit 1; }' + - '[ -n "$$ARCHIE_CANARY_TOKEN" ] || { echo "repo secret canary_token is not set, so the canary cannot be reached"; exit 1; }' + - '[ -n "$$DEPLOY_TOKEN" ] || { echo "repo secret deploy_token is not set, so the registry cannot be tagged"; exit 1; }' + - go build -tags no_ui -o /tmp/archied ./cmd/archied + # archied reads the registry credentials a docker login would have + # written; this step has no docker CLI, so the file is written directly. + - | + set -eu + mkdir -p "$$HOME/.docker" + auth=$(printf '%s:%s' "$$CI_REPO_OWNER" "$$DEPLOY_TOKEN" | base64 -w0) + printf '{"auths":{"git.catlow.cloud":{"auth":"%s"}}}\n' "$$auth" > "$$HOME/.docker/config.json" + - >- + /tmp/archied release canary promote -dashboard "$$CANARY_URL" + -version "$$VERSION" + -latest git.catlow.cloud/sam/archied,git.catlow.cloud/sam/archie-agent diff --git a/.woodpecker/quality.yaml b/.woodpecker/quality.yaml new file mode 100644 index 000000000..728f0650c --- /dev/null +++ b/.woodpecker/quality.yaml @@ -0,0 +1,60 @@ +# Pull-request gate: the same `task check` the maintainer runs locally. +# +# One step, not one step per check: `task check` installs task, golangci-lint, +# gofumpt, buf and sqlc into the container it runs in, and a second step starts +# from an empty container and pays for that again. + +when: + - event: [pull_request] + +clone: + git: + image: woodpeckerci/plugin-git:2.8.0 + settings: + # The gate compares the contracts against main and reads the release tags + # for the version a build reports, so a partial clone will not do. + tags: true + # A pull-request pipeline otherwise clones only the pull request's own + # ref, leaving no main for the contract baseline to compare against. + fetch_target_branch: true + +steps: + - name: check + image: golang:1.27.3-bookworm + commands: + - go install github.com/go-task/task/v3/cmd/task@v3.48.0 + - go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(cat .golangci-version) + - go install mvdan.cc/gofumpt@v0.11.0 + - bash tools/proto.sh install + # The gate builds and tests the dashboard, so Node and pnpm sit next to + # Go. Pinned tarball verified by digest, not a third-party setup script: + # the gate must not change under the repository. + - | + set -eu + apt-get update -qq + apt-get install -y -qq --no-install-recommends xz-utils + curl -fsSL -o /tmp/node.tar.xz https://nodejs.org/dist/v24.22.2/node-v24.22.2-linux-x64.tar.xz + echo "48cc0e21e048790e54c0cf5749c2725005313d652651c40b7a21feb9697aaf75 /tmp/node.tar.xz" | sha256sum -c - + tar -xJf /tmp/node.tar.xz -C /usr/local --strip-components=1 + # pnpm's version belongs to the lockfile; installing any other one makes + # `pnpm install --frozen-lockfile` reject the tree. + npm install -g "pnpm@$(node -p 'require("./ui/package.json").packageManager.split("@")[1]')" + node --version + pnpm --version + - | + set -eu + # The contract baseline is a local main. plugin-git fetches with an explicit + # refspec, so it creates no remote-tracking branch itself; only the target + # branch fetch above does, which is why this fails rather than comparing + # the pull request against its own tree. + if ! git show-ref --verify --quiet refs/heads/main; then + if ! git rev-parse --verify --quiet origin/main >/dev/null; then + echo "no main in this clone, so the contracts cannot be compared against a baseline" >&2 + exit 1 + fi + git branch main origin/main + fi + - task --concurrency 1 check + # The gate rewrites the tree (fmt, generated contracts and queries); a + # rewrite the author did not commit is a failure, not a side effect. + - git diff --exit-code diff --git a/.woodpecker/release.yaml b/.woodpecker/release.yaml new file mode 100644 index 000000000..b8aed87cc --- /dev/null +++ b/.woodpecker/release.yaml @@ -0,0 +1,50 @@ +# Manual release: turn [Unreleased] in CHANGELOG.md into a release commit, tag +# it, and push main and the tag in one command. The deploy pipeline publishes +# what this pushes, so this workflow commits and tags but never builds. +# +# Start it with the pipeline variable RELEASE=minor (or major, patch, or an +# exact 1.2.3): woodpecker-cli pipeline create --branch main --var RELEASE=minor +# sam/archie, or the same variable in the web UI's pipeline dialog. +# +# Shell-side references are written $$name (see the note in deploy.yaml). +# +# Requires repo secret deploy_token, a token that may push to main and to tags. + +when: + - event: [manual] + +# Two releases at once would read the same last tag and try to write it twice. +concurrency: 1 + +clone: + git: + image: woodpeckerci/plugin-git:2.8.0 + settings: + # `task release` derives the next version from the release tags. + tags: true + fetch_target_branch: true + +steps: + - name: cut + image: golang:1.27.3-bookworm + environment: + DEPLOY_TOKEN: + from_secret: deploy_token + commands: + - '[ -n "$$RELEASE" ] || { echo "RELEASE is empty: start this workflow with the pipeline variable RELEASE=major|minor|patch|x.y.z"; exit 1; }' + - '[ -n "$$DEPLOY_TOKEN" ] || { echo "repo secret deploy_token is not set, so the release cannot push its commit and tag"; exit 1; }' + - go install github.com/go-task/task/v3/cmd/task@v3.48.0 + - git config user.name "Sam Catlow" + - git config user.email "sam@catlow.tech" + - task release RELEASE="$$RELEASE" + - | + set -eu + tag=$(git describe --exact-match --match 'v*' HEAD) + # HEAD, not a local main: the clone checks out the fetched ref detached, + # so there is no branch to name. The release commit is a child of main, + # so this is the fast-forward an atomic push needs. + # + # Gitea authenticates a token in the password position and ignores the + # user name, so the token never has to be a real login. + git push --atomic "https://x-access-token:$$DEPLOY_TOKEN@git.catlow.cloud/sam/archie.git" HEAD:refs/heads/main "$$tag" + echo "released $$tag"