diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 83472d1..77b23b1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -80,6 +80,12 @@ jobs: make build docker build --progress=plain --build-arg VERSION="$(git describe --tags --always)" -t runlike-local:dev . RUNLIKE_BIN="$PWD/build/runlike" RUNLIKE_IMAGE=runlike-local:dev go test -count=1 ./test/compat/ + # The .debs from make cross, and a repository signed with a + # throwaway key, installed in debian:stable and ubuntu:24.04. + - name: apt packages and repository + env: + DOCKER_HOST: unix:///var/run/docker.sock + run: test/apt/test.sh dist # Windows containers on Docker Engine 29.9.3: the Windows round trip, and # the PowerShell and cmd quoting in the real shells (fuzz and live). diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 920b702..18578e8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,7 +6,9 @@ # publishes the GitHub release (those notes, binaries, SHA256SUMS; the macOS # binary signed and notarized by Apple first, job build) and the # image assaflavie/runlike:X.Y.Z (+ :latest for the newest non-prerelease), -# and, for the newest non-prerelease, the formula in lavie/homebrew-tap. +# the .deb packages (also in the release), and, for the newest +# non-prerelease, the formula in lavie/homebrew-tap and the signed APT +# repository lavie/apt (https://lavie.github.io/apt). # A version whose release failed stays pending: the next push to master # releases it on that newer commit. # @@ -14,7 +16,8 @@ # version: without "republish" it releases that pending version on the # current master head (its tag must not exist); with "republish" it publishes # the existing tag again from the tagged commit. The secrets (DOCKERHUB_TOKEN, -# HOMEBREW_TAP_TOKEN, the Apple signing and notarization secrets) live only in the environment +# HOMEBREW_TAP_TOKEN, APT_REPO_TOKEN, APT_GPG_PRIVATE_KEY, APT_GPG_PASSPHRASE, +# the Apple signing and notarization secrets) live only in the environment # "release", which deploys from master only. # Never publishes to PyPI. name: release @@ -168,22 +171,25 @@ jobs: repository: lavie/homebrew-tap token: ${{ secrets.HOMEBREW_TAP_TOKEN }} path: .tap - # The formula script comes from the workflow's own commit, so a - # republish of a tag older than the script updates the tap too. + # The APT repository, for the same reason and the same versions. + - if: env.LATEST == 'true' + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: lavie/apt + token: ${{ secrets.APT_REPO_TOKEN }} + path: .apt + # The formula and package scripts come from the workflow's own commit, + # so a republish of a tag older than the scripts updates them too. - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: path: .tools - sparse-checkout: scripts/homebrew-formula.sh + sparse-checkout: | + scripts/homebrew-formula.sh + scripts/deb.sh + scripts/apt-repo.sh + LICENSE.txt sparse-checkout-cone-mode: false persist-credentials: false - - name: Tag the release commit - run: | - if git rev-parse -q --verify "refs/tags/$TAG" >/dev/null; then - test "$(git rev-list -n1 "$TAG")" = "$COMMIT" || { echo "$TAG is not on $COMMIT"; exit 1; } - else - git tag "$TAG" "$COMMIT" - git push origin "refs/tags/$TAG" - fi - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 with: name: release-dist @@ -197,6 +203,40 @@ jobs: test -n "$DARWIN_SHA256" test "$(awk '$2 == "runlike-darwin-arm64" {print $1}' SHA256SUMS)" = "$DARWIN_SHA256" \ || { echo "runlike-darwin-arm64 is not the signed binary from build"; exit 1; } + # The .debs, from those same Linux binaries; dated by the release + # commit, so a republish builds the same bytes. deb.sh adds them to + # SHA256SUMS. + - name: .deb packages + run: | + SOURCE_DATE_EPOCH=$(git log -1 --format=%ct "$COMMIT") .tools/scripts/deb.sh "$VERSION" dist + # Sign the APT repository before the tag, so a bad key or passphrase + # stops the release here; it is pushed after the image. apt-repo.sh + # refuses a key other than the one the repository already publishes. + - name: APT repository + if: env.LATEST == 'true' + env: + APT_GPG_PRIVATE_KEY: ${{ secrets.APT_GPG_PRIVATE_KEY }} + APT_GPG_PASSPHRASE: ${{ secrets.APT_GPG_PASSPHRASE }} + run: | + command -v apt-ftparchive >/dev/null || { sudo apt-get update -q && sudo apt-get install -y -q apt-utils; } + export GNUPGHOME="$RUNNER_TEMP/gnupg" + install -d -m 700 "$GNUPGHOME" + gpg --batch --import <<<"$APT_GPG_PRIVATE_KEY" + .tools/scripts/apt-repo.sh .apt dist/runlike_*.deb + gpg --batch --verify .apt/dists/stable/InRelease + rm -rf "$GNUPGHOME" + cd .apt + git add -A + git diff --cached --quiet || git -c user.name="github-actions[bot]" -c user.email="41898282+github-actions[bot]@users.noreply.github.com" \ + commit -qm "runlike $VERSION" + - name: Tag the release commit + run: | + if git rev-parse -q --verify "refs/tags/$TAG" >/dev/null; then + test "$(git rev-list -n1 "$TAG")" = "$COMMIT" || { echo "$TAG is not on $COMMIT"; exit 1; } + else + git tag "$TAG" "$COMMIT" + git push origin "refs/tags/$TAG" + fi - name: GitHub release env: GH_TOKEN: ${{ github.token }} @@ -231,3 +271,6 @@ jobs: git -c user.name="github-actions[bot]" -c user.email="41898282+github-actions[bot]@users.noreply.github.com" \ commit -qm "runlike $VERSION" git push origin HEAD + - name: APT repository push + if: env.LATEST == 'true' + run: git -C .apt push origin HEAD diff --git a/README.md b/README.md index 113f085..b4a2c07 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,22 @@ option of Docker CLI v29.9.3 (see [Supported options](#supported-options)). brew install lavie/tap/runlike ``` +- **apt** on Debian and Ubuntu (amd64, arm64), from the signed repository + [lavie/apt](https://github.com/lavie/apt). Once: + + ``` + sudo install -d -m 0755 /etc/apt/keyrings + sudo curl -fsSLo /etc/apt/keyrings/runlike.asc https://lavie.github.io/apt/runlike.asc + printf 'Types: deb\nURIs: https://lavie.github.io/apt\nSuites: stable\nComponents: main\nSigned-By: /etc/apt/keyrings/runlike.asc\n' \ + | sudo tee /etc/apt/sources.list.d/runlike.sources >/dev/null + ``` + + Then `sudo apt-get update && sudo apt-get install runlike`; `apt-get + upgrade` keeps it current. Without the repository: download + `runlike_X.Y.Z_amd64.deb` (or `_arm64.deb`) from the releases page and + run `sudo apt install ./runlike_*.deb`. The package suggests the Docker + CLI but does not install it: use `docker-ce-cli`, `docker.io` or a remote + context. - **With Go** (1.24 or later): ``` diff --git a/RELEASING.md b/RELEASING.md index ab90123..f716b3c 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -86,7 +86,16 @@ On every push to `master`: release waits for one. 4. **publish**, in the environment `release`: - It tags that commit `vX.Y.Z`. - - It takes the binaries and `SHA256SUMS` from build, unchanged. + - It takes the binaries and `SHA256SUMS` from build, unchanged, and + builds `runlike_X.Y.Z_amd64.deb` and `_arm64.deb` from the Linux + binaries ([scripts/deb.sh](scripts/deb.sh)), adding them to + `SHA256SUMS`. + - For the newest non-prerelease, it adds the .debs to the APT + repository [lavie/apt](https://github.com/lavie/apt) and signs it + ([scripts/apt-repo.sh](scripts/apt-repo.sh)), still before the tag, + so a bad key or token stops the release there. It pushes the + repository after the image; GitHub Pages serves it at + `https://lavie.github.io/apt`. - It creates the GitHub release with the notes file as its text and attaches the binaries. - It pushes the image `assaflavie/runlike:X.Y.Z` for linux/amd64 and @@ -97,6 +106,8 @@ On every push to `master`: ([scripts/homebrew-formula.sh](scripts/homebrew-formula.sh)): the release binaries for macOS arm64 and Linux, with their checksums. Users install with `brew install lavie/tap/runlike`. + - It pushes the APT repository. Users install with `apt-get install + runlike` after the one-time setup in the README. The release commit is the master commit the merge pushed, never a commit from the pull request's branch. With a merge commit, that is the merge @@ -160,6 +171,22 @@ Never publish to PyPI. The Python 1.x package is frozen. - [ ] **The tap repository `lavie/homebrew-tap`**: public. The release workflow writes its `Formula/runlike.rb`; do not edit that file by hand. +- [ ] **The APT repository `lavie/apt`**: public, created with a README + (the workflow cannot check out an empty repository). Settings > + Pages: "Deploy from a branch", branch `main`, folder `/ (root)`. The + release workflow writes everything else; do not edit it by hand. + - Environment secret `APT_REPO_TOKEN`: a fine-grained GitHub token + owned by `lavie`, with access to `lavie/apt` only and the permission + Contents: Read and write. Renew it before it expires, or releases fail + before the tag. + - Environment secrets `APT_GPG_PRIVATE_KEY` (the ASCII-armored secret + key, `gpg --armor --export-secret-keys FINGERPRINT`) and + `APT_GPG_PASSPHRASE`: a dedicated ed25519 signing key that signs + nothing else, with no expiry. Keep a copy in the password manager. + Users trust the published `runlike.asc`; `scripts/apt-repo.sh` + refuses to sign with any other key. To replace the key, delete + `runlike.asc` from `lavie/apt` first, and tell users to download it + again. - [ ] **Settings > Secrets and variables > Actions**: no repository-level secrets. Delete `DOCKERHUB_TOKEN` there if it exists. - [ ] **Settings > Rules > Rulesets > New branch ruleset** for `master` diff --git a/docs/assets/site.css b/docs/assets/site.css index a318cb9..74c1390 100644 --- a/docs/assets/site.css +++ b/docs/assets/site.css @@ -157,7 +157,7 @@ main > section { padding: clamp(3rem, 7vw, 5.5rem) max(var(--pad), calc((100% - .ways input.tab:checked + label.tab { color: var(--text); border-color: var(--border); border-bottom-color: var(--surface); background: var(--surface); } .ways input.tab:focus-visible + label.tab { outline: 3px solid var(--accent); outline-offset: -3px; } .ways .way { display: none; width: 100%; order: 1; padding: 1.4rem 0 .6rem; border-top: 1px solid var(--border); } -#way-sh:checked ~ #way-sh-panel, #way-brew:checked ~ #way-brew-panel, #way-go:checked ~ #way-go-panel, #way-docker:checked ~ #way-docker-panel { display: block; } +#way-sh:checked ~ #way-sh-panel, #way-brew:checked ~ #way-brew-panel, #way-apt:checked ~ #way-apt-panel, #way-go:checked ~ #way-go-panel, #way-docker:checked ~ #way-docker-panel { display: block; } .copy-block { display: flex; align-items: flex-start; background: var(--term-bg); color: var(--term-text); border-radius: 10px; margin: 0 0 .8rem; } .copy-block pre { flex: 1; min-width: 0; padding: .9rem 1rem; font: 13px/1.6 var(--mono); overflow-x: auto; } @media (max-width: 600px) { .copy-block pre { white-space: pre-wrap; overflow-wrap: anywhere; } } diff --git a/docs/index.html b/docs/index.html index feb3df5..7a679b8 100644 --- a/docs/index.html +++ b/docs/index.html @@ -104,6 +104,7 @@
On macOS (Apple Silicon) and Linux, from the tap lavie/homebrew-tap. brew upgrade keeps it current.
brew install lavie/tap/runlikeOn Debian and Ubuntu (amd64, arm64), from the signed repository lavie/apt. Add it once:
+sudo install -d -m 0755 /etc/apt/keyrings
+sudo curl -fsSLo /etc/apt/keyrings/runlike.asc https://lavie.github.io/apt/runlike.asc
+printf 'Types: deb\nURIs: https://lavie.github.io/apt\nSuites: stable\nComponents: main\nSigned-By: /etc/apt/keyrings/runlike.asc\n' \
+ | sudo tee /etc/apt/sources.list.d/runlike.sources >/dev/nullThen install. apt-get upgrade keeps it current:
sudo apt-get update && sudo apt-get install runlikeOr download the .deb from the latest release and sudo apt install ./runlike_*.deb. The Docker CLI is suggested, not installed.
Go 1.24 or later. Lands in $(go env GOPATH)/bin.
go install github.com/lavie/runlike/v2/cmd/runlike@latest