Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,19 @@ jobs:
fi
git push origin "v${VERSION}"

chart_dir="${RUNNER_TEMP}/helm-index"
prev="${RUNNER_TEMP}/helm-index-prev"
rm -rf "$chart_dir" "$prev"
mkdir -p "$chart_dir" "$prev"
cp "dist/squirrelbot-${VERSION}.tgz" "$chart_dir/"
index_url="https://github.com/${GITHUB_REPOSITORY}/releases/download/v${VERSION}"
merge_args=()
if gh release download --pattern index.yaml --dir "$prev" --clobber >/dev/null 2>&1; then
merge_args=(--merge "$prev/index.yaml")
fi
helm repo index "$chart_dir" --url "$index_url" "${merge_args[@]}"
cp "$chart_dir/index.yaml" dist/index.yaml

latest=$(git tag --list 'v*' --sort=-v:refname | awk -v current="v${VERSION}" '$0 != current && /^v[0-9]+\.[0-9]+\.[0-9]+$/ { print; exit }')
notes="${RUNNER_TEMP}/notes.md"
{
Expand All @@ -436,7 +449,8 @@ jobs:
echo "Helm chart:"
echo
echo '```sh'
echo "helm upgrade --install squirrelbot oci://${CHART}/squirrelbot --version ${VERSION}"
echo "helm repo add squirrelbot https://github.com/${GITHUB_REPOSITORY}/releases/latest/download"
echo "helm upgrade --install squirrelbot squirrelbot/squirrelbot --version ${VERSION}"
echo '```'
echo
echo "Binary archives include \`squirrelbot\`, \`web/build\`, and \`LICENSE\`. Extract an archive and run \`./squirrelbot\` from that directory."
Expand All @@ -455,6 +469,7 @@ jobs:
--title "v${VERSION}" \
--notes-file "$notes" \
"dist/SHA256SUMS" \
"dist/index.yaml" \
dist/squirrelbot_"${VERSION}"_*.tar.gz \
"dist/squirrelbot-${VERSION}.tgz"

Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Copy `.env.example` to `.env` and fill in the Discord token, OAuth client id, OA

The chart is `deploy/helm/squirrelbot`. It runs one replica with the Recreate strategy, a read-only root filesystem, and a non-root user. Liveness is `/healthz`. Readiness is `/readyz`, which stays down until Postgres answers and the Discord gateway is ready.

Supply secrets with `--set`, a private values file, or `existingSecret`. The secret keys are `DATABASE_URL`, `DISCORD_TOKEN`, `DISCORD_CLIENT_ID`, `DISCORD_CLIENT_SECRET`, and `SESSION_SECRET`.
`--set` and a private values file make the chart create the Secret. To use a Secret that already exists, set `existingSecret` to its name. The chart then mounts that Secret and does not create one. The keys are `DATABASE_URL`, `DISCORD_TOKEN`, `DISCORD_CLIENT_ID`, `DISCORD_CLIENT_SECRET`, and `SESSION_SECRET`.

`deploy/flux/squirrelbot-kustomization.yaml` is a Flux Kustomization for the published chart. It reconciles `deploy/flux/squirrelbot`. Create a Secret named `squirrelbot` in the `squirrelbot` namespace before the first reconcile, with those keys. Point `sourceRef` at your Flux GitRepository when it is not named `flux-system`. Pin `version` in the HelmRelease to stop automatic upgrades.

Expand Down Expand Up @@ -88,10 +88,16 @@ Each release includes:

- Archives for Linux and macOS, on amd64 and arm64. An archive contains `squirrelbot`, `web/build`, and `LICENSE`. Extract it and run `./squirrelbot` from that directory.
- The image `ghcr.io/boxingoctopuscreative/squirrelbot`, tagged with the version and with `latest`.
- The Helm chart, attached to the GitHub release and published to `oci://ghcr.io/boxingoctopuscreative/charts/squirrelbot`.
- The Helm chart, attached to the GitHub release and published to `oci://ghcr.io/boxingoctopuscreative/charts/squirrelbot`. Each release also carries an `index.yaml`, so Helm can add the release archive as a chart repository.

The published chart uses that GHCR image. The chart in this repository keeps the local image name `squirrelbot`, which matches `make image`. Install the published chart with the same `--set` values as the local chart, and set `--version` to the release you want.

```sh
helm repo add squirrelbot https://github.com/BoxingOctopusCreative/SquirrelBot/releases/latest/download
helm repo update
helm upgrade --install squirrelbot squirrelbot/squirrelbot --version 0.1.0
```

CI sets the GHCR package visibility to match the repository.

## License
Expand Down
Loading