projects

showcase

A public git mirror

ci: push images to Gitea's tailnet registry

daniel daum committed parent 5145f47 commit 3ed9da7

Showing 7 changed files with 22 additions and 14 deletions.

.gitea/workflows/release.yml +4 −3
@@ -13,9 +13,6 @@ on:1313permissions:1414  contents: write # the Gitea release151516env:17  IMAGE: git.danieldaum.net/daniel/showcase181916jobs:2017  release:2118    runs-on: ubuntu-latest@@ -28,6 +25,10 @@ jobs:2825        env:2926          TOKEN: ${{ secrets.REGISTRY_TOKEN }}3027        run: |28          # Gitea's own host is the registry: <host>/daniel/showcase29          host=${GITHUB_SERVER_URL#*://}30          IMAGE=${host%/}/$GITHUB_REPOSITORY31          echo "IMAGE=$IMAGE" >> "$GITHUB_ENV"3132          printf '%s' "$TOKEN" | docker login "${IMAGE%%/*}" -u "$GITHUB_REPOSITORY_OWNER" --password-stdin3233          docker build --platform linux/amd64 -t "$IMAGE:${GITHUB_REF_NAME#v}" -t "$IMAGE:latest" .3334          docker push "$IMAGE:latest"
README.md +4 −4
@@ -59,8 +59,8 @@ it at danieldaum.net/projects are in [deploy/README.md](deploy/README.md).5959### Release a version60606161A release is a git tag `v<version>`, an image62`git.danieldaum.net/daniel/showcase:<version>` (also tagged `latest`) and63a Gitea release. Versions follow semver: a fix bumps the patch (0.2.0 →62`code.aardvark-halibut.ts.net/daniel/showcase:<version>` (also tagged `latest`, in Gitea's63registry on the tailnet) and a Gitea release. Versions follow semver: a fix bumps the patch (0.2.0 →64640.2.1), a feature the minor (0.2.0 → 0.3.0). The examples release 0.2.1.65656666You commit, tag and deploy. Pushing the tag starts@@ -109,9 +109,9 @@ Docker (act_runner gives jobs the host's Docker by default).109109**Without CI**, from the Mac, after step 2:110110111111```sh112docker login git.danieldaum.net     # once; a Gitea token with write:package112docker login code.aardvark-halibut.ts.net   # once; a Gitea token with write:package113113just release 0.2.1                  # same image and tags; no Gitea release114crane digest git.danieldaum.net/daniel/showcase:0.2.1114crane digest code.aardvark-halibut.ts.net/daniel/showcase:0.2.1115115```116116117117Use one or the other for a version: a rebuild gets a new digest.
deploy/README.md +2 −2
@@ -48,7 +48,7 @@ them when you like.4848## 2. Gitea on the tailnet49495050Set `gitea_url` to the tailnet address (for example51`https://git.aardvark-halibut.ts.net`) and restart the container. Mirrors51`https://code.aardvark-halibut.ts.net`) and restart the container. Mirrors5252follow the new address on the next build. Nothing else changes: Gitea's5353address never reaches a page.5454@@ -66,7 +66,7 @@ Check from the server:6666`docker compose exec showcase wget -qO- <gitea_url>/api/v1/version`.67676868Once Gitea is internal, the server pulls the image from the tailnet name69(`git.aardvark-halibut.ts.net/daniel/showcase`), or from showcase itself69(`code.aardvark-halibut.ts.net/daniel/showcase`), or from showcase itself7070(`code.danieldaum.net/daniel/showcase`).71717272## 3. danieldaum.net/projects
deploy/compose.yaml +3 −2
@@ -1,9 +1,10 @@11# showcase at code.danieldaum.net. The reverse proxy terminates TLS and22# forwards to 127.0.0.1:8080. config.json sits next to this file.3# Image: showcase 0.1.0 (linux/amd64 + linux/arm64), pinned by digest.3# Image: showcase 0.1.0 (linux/amd64 + linux/arm64), pinned by digest, from4# Gitea's registry on the tailnet.45services:56  showcase:6    image: git.danieldaum.net/daniel/showcase@sha256:e5d3d45006795cbf34f6e43780803f76731a3d1d2b31a8ea7bb333c719399e167    image: code.aardvark-halibut.ts.net/daniel/showcase@sha256:e5d3d45006795cbf34f6e43780803f76731a3d1d2b31a8ea7bb333c719399e1678    container_name: showcase89    restart: unless-stopped910    ports:
deploy/config.json +1 −1
@@ -1,5 +1,5 @@11{2    "gitea_url": "https://git.danieldaum.net",2    "gitea_url": "https://code.aardvark-halibut.ts.net",33    "user": "daniel",44    "site_url": "https://code.danieldaum.net",55    "repos": ["showcase", "saturn", "holonet", "rhea", "minerva", "homelab", "dotfiles"],
docs/decisions.md +6 −0
@@ -936,6 +936,12 @@ never `latest`, so nothing reaches it that Daniel didn't pin.936936  The release is written with the run token, `GITEA_TOKEN`. Both reach937937  the scripts as environment variables, and the tag name is read from938938  `$GITHUB_REF_NAME`, so nothing is interpolated into a script.939- **Registry host:** Gitea moved to the tailnet940  (`code.aardvark-halibut.ts.net`), and `git.danieldaum.net/v2/` now941  answers 404. The workflow takes the registry host from942  `$GITHUB_SERVER_URL`, Gitea's own address, so it follows Gitea if it943  moves again. The justfile, compose.yaml and the docs name the tailnet944  host. The pinned 0.1.0 digest is the same there (checked with crane).939945- **Release notes:** the image with its digest (to pin in compose.yaml)940946  and the commit subjects since the previous tag. A release that already941947  exists makes the step fail after the image is pushed.
justfile +2 −2
@@ -25,13 +25,13 @@ digests:2525    @echo "golang:1.27.4-alpine3.24 $(crane digest golang:1.27.4-alpine3.24)"2626    @echo "alpine:3.24.4            $(crane digest alpine:3.24.4)"272728image_name := "git.danieldaum.net/daniel/showcase"28image_name := "code.aardvark-halibut.ts.net/daniel/showcase"29293030# Build the image for this machine (needs Docker, e.g. on the host)3131image tag="dev":3232    docker build -t {{image_name}}:{{tag}} .333334# Push a tagged release by hand, as CI does (linux/amd64, for the server): needs Docker, `docker login git.danieldaum.net`, a clean tree and HEAD tagged v<version>34# Push a tagged release by hand, as CI does (linux/amd64, for the server): needs Docker, `docker login code.aardvark-halibut.ts.net`, a clean tree and HEAD tagged v<version>3535release version:3636    git diff --quiet HEAD || { echo "commit first"; exit 1; }3737    test "$(git describe --exact-match --tags HEAD 2>/dev/null)" = "v{{version}}" || { echo "tag HEAD as v{{version}} first"; exit 1; }