ci: build the celld image for Homeflare and push it to GHCR
Tagged with the first 12 of the commit, and main.
Jason Schwarzenberger authored 1 parent 6d0368acommit fccdc3eddf23298d2f56bfcce74f2d43ae768bb3Browse files
2 files changed+75−3
added.github/workflows/homeflare-image.yml+69−0View file
| @@ -1,0 +1,69 @@ | ||
| 1 | +name: Homeflare image | |
| 2 | + | |
| 3 | +# Builds this fork's celld image and pushes it to GHCR, for Homeflare's | |
| 4 | +# runtime image to build on: | |
| 5 | +# | |
| 6 | +# ghcr.io/<owner>/celld:<first 12 of the commit> what Homeflare pins | |
| 7 | +# ghcr.io/<owner>/celld:main the latest main | |
| 8 | +# | |
| 9 | +# The Dockerfile is upstream's: the image builds only if cargo test and | |
| 10 | +# cargo clippy -D warnings pass. Layers are cached in the registry | |
| 11 | +# (:buildcache-amd64), so a patch only rebuilds what it touches. | |
| 12 | +# | |
| 13 | +# Upstream's release.yml (native binaries, ghcr.io/denoland/celld) is left as | |
| 14 | +# it is; it only runs on a `candidate` push or a published release. | |
| 15 | +on: | |
| 16 | + push: | |
| 17 | + branches: [main] | |
| 18 | + paths-ignore: | |
| 19 | + - "**.md" | |
| 20 | + - "docs/**" | |
| 21 | + - "homeflare/smoke/**" | |
| 22 | + workflow_dispatch: | |
| 23 | + | |
| 24 | +permissions: | |
| 25 | + contents: read | |
| 26 | + | |
| 27 | +concurrency: | |
| 28 | + group: homeflare-image-${{ github.ref }} | |
| 29 | + cancel-in-progress: true | |
| 30 | + | |
| 31 | +jobs: | |
| 32 | + image: | |
| 33 | + name: Build and push | |
| 34 | + runs-on: ubuntu-22.04 | |
| 35 | + timeout-minutes: 120 | |
| 36 | + permissions: | |
| 37 | + contents: read | |
| 38 | + packages: write | |
| 39 | + steps: | |
| 40 | + - uses: actions/checkout@v6 | |
| 41 | + | |
| 42 | + - uses: docker/setup-buildx-action@v3 | |
| 43 | + | |
| 44 | + - name: Log in to GHCR | |
| 45 | + env: | |
| 46 | + GHCR_TOKEN: ${{ github.token }} | |
| 47 | + run: | | |
| 48 | + printf '%s' "$GHCR_TOKEN" | | |
| 49 | + docker login ghcr.io --username "$GITHUB_ACTOR" --password-stdin | |
| 50 | + | |
| 51 | + - name: Build, test and push | |
| 52 | + run: | | |
| 53 | + set -euo pipefail | |
| 54 | + image="ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/celld" | |
| 55 | + version=$(sed -n 's/^version = "\(.*\)"$/\1/p' crates/celld/Cargo.toml | head -1) | |
| 56 | + docker buildx build \ | |
| 57 | + --platform linux/amd64 \ | |
| 58 | + --build-arg "CELLD_COMMIT=$GITHUB_SHA" \ | |
| 59 | + --build-arg "CELLD_VERSION=$version" \ | |
| 60 | + --label "org.opencontainers.image.source=https://github.com/$GITHUB_REPOSITORY" \ | |
| 61 | + --cache-from "type=registry,ref=$image:buildcache-amd64" \ | |
| 62 | + --cache-to "type=registry,ref=$image:buildcache-amd64,mode=max" \ | |
| 63 | + --tag "$image:${GITHUB_SHA::12}" \ | |
| 64 | + --tag "$image:main" \ | |
| 65 | + --push \ | |
| 66 | + . | |
| 67 | + echo "### Pushed \`$image:${GITHUB_SHA::12}\`" >> "$GITHUB_STEP_SUMMARY" | |
| 68 | + echo "" >> "$GITHUB_STEP_SUMMARY" | |
| 69 | + echo "Homeflare: \`HOMEFLARE_CELLD_IMAGE=$image:${GITHUB_SHA::12}\`" >> "$GITHUB_STEP_SUMMARY" |
modifiedHOMEFLARE.md+6−3View file
| @@ -35,9 +35,12 @@ | ||
| 35 | 35 | |
| 36 | 36 | ## Building |
| 37 | 37 | |
| 38 | -Homeflare builds this repo into its runtime image: set | |
| 39 | -`HOMEFLARE_CELLD_SOURCE=https://github.com/jason-s13r/celld.git` in | |
| 40 | -`homeflare.env` (see Homeflare's README). By hand, with Podman: | |
| 38 | +Each push to `main` builds `ghcr.io/jason-s13r/celld:<first 12 of the commit>` | |
| 39 | +(and `:main`) with `.github/workflows/homeflare-image.yml`. Homeflare's runtime | |
| 40 | +image builds on one of these, pinned in its `deploy/runtime/Containerfile`; | |
| 41 | +`HOMEFLARE_CELLD_IMAGE` in `homeflare.env` picks another. To build celld from | |
| 42 | +source instead, set `HOMEFLARE_CELLD_SOURCE` to a git URL (see Homeflare's | |
| 43 | +README). By hand, with Podman: | |
| 41 | 44 | |
| 42 | 45 | ```sh |
| 43 | 46 | podman build -t localhost/homeflare-celld:dev \ |