ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Canceled after 5m11s
ci / test (pull_request) Canceled after 5m11s
ci / build (pull_request) Canceled after 0s
ci / image (pull_request) Canceled after 0s
deploy/helm/uptimesebi runs the console and API (Deployment, Service, PodDisruptionBudget, Ingress) and optionally an in-cluster checker and status page servers. PostgreSQL and Redis are your own: by URL, from an existing secret, or Redis through Sentinel; Redis is not bundled. For trying it out, a single TimescaleDB can be bundled; its volume and password survive an uninstall and are picked up again by a reinstall. Migrations run as a pre-install/pre-upgrade hook with its own short-lived copy of the secrets; with the bundled database, which does not exist before the install, as an init container (runs serialize on the migration lock). Pods run as 65532 with a read-only root filesystem, no capabilities and RuntimeDefault seccomp; checkers get the safe ping sysctl. Missing settings fail rendering with a message. CI lints and renders the chart in several configurations; releases package it with the release version, sign it with the checksums and push it to the Gitea Helm registry. Closes #35 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
98 lines
4.6 KiB
YAML
98 lines
4.6 KiB
YAML
name: release
|
|
|
|
# Runs for release tags, which `make release` creates. Only the Owners team
|
|
# may push v* tags (tag protection), and only tags on main are released.
|
|
# The image of a tag is built by the ci workflow.
|
|
on:
|
|
push:
|
|
tags: ["v*"]
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
with:
|
|
# The notes need the history back to the previous release.
|
|
fetch-depth: 0
|
|
- name: Install Go
|
|
run: |
|
|
v="$(awk '/^go /{print $2}' go.mod)"
|
|
curl -fsSL "https://go.dev/dl/go${v}.linux-amd64.tar.gz" | tar -C /usr/local -xz
|
|
echo /usr/local/go/bin >> "$GITHUB_PATH"
|
|
- name: Check tag
|
|
run: |
|
|
go run ./tools/release check "$GITHUB_REF_NAME"
|
|
# Only code that reached main through a protected merge is
|
|
# released, this workflow included: a tag on any other commit,
|
|
# e.g. one with a changed workflow, publishes nothing.
|
|
git fetch -q origin main
|
|
if ! git merge-base --is-ancestor "$GITHUB_SHA" origin/main; then
|
|
echo "::error::$GITHUB_REF_NAME does not point to a commit on main; not releasing."
|
|
exit 1
|
|
fi
|
|
- name: Build frontend
|
|
run: npm ci --no-audit --no-fund && npm run build
|
|
- name: Package Helm chart
|
|
run: |
|
|
curl -fsSL "https://get.helm.sh/helm-v3.19.0-linux-amd64.tar.gz" | tar -xz -C /usr/local/bin --strip-components=1 linux-amd64/helm
|
|
# Chart and app version follow the release; image tags drop the v.
|
|
helm package deploy/helm/uptimesebi --version "${GITHUB_REF_NAME#v}" --app-version "${GITHUB_REF_NAME#v}" -d dist
|
|
- name: Build binaries
|
|
run: |
|
|
set -eu
|
|
pkg=git.zb-server.de/ZB-Server/uptimesebi/internal/buildinfo
|
|
commit="$(git rev-parse --short=12 HEAD)"
|
|
for platform in linux/amd64 linux/arm64 linux/arm/v7 linux/arm/v6; do
|
|
IFS=/ read -r os arch variant <<< "$platform"
|
|
dir="uptimesebi_${GITHUB_REF_NAME#v}_${os}_${arch}${variant}"
|
|
CGO_ENABLED=0 GOOS=$os GOARCH=$arch GOARM=${variant#v} go build -trimpath \
|
|
-ldflags "-s -w -X $pkg.Version=$GITHUB_REF_NAME -X $pkg.Commit=$commit" \
|
|
-o "dist/$dir/" ./cmd/...
|
|
cp LICENSE README.md .env.example "dist/$dir/"
|
|
tar -C dist -czf "dist/$dir.tar.gz" "$dir"
|
|
done
|
|
go run ./tools/release sbom "$GITHUB_REF_NAME" dist/uptimesebi_*_linux_amd64/{api,checker,statuspage} > dist/sbom.spdx.json
|
|
(cd dist && sha256sum ./*.tar.gz ./*.tgz ./sbom.spdx.json | sed 's| \./| |' > SHA256SUMS)
|
|
cat dist/SHA256SUMS
|
|
- name: Sign checksums
|
|
env:
|
|
RELEASE_SIGNING_KEY: ${{ secrets.RELEASE_SIGNING_KEY }}
|
|
run: |
|
|
if [ -z "$RELEASE_SIGNING_KEY" ]; then
|
|
echo "::warning::RELEASE_SIGNING_KEY is not set; the release is not signed."
|
|
exit 0
|
|
fi
|
|
go run ./tools/release sign dist/SHA256SUMS "$GITHUB_REF_NAME"
|
|
go run ./tools/release verify dist/SHA256SUMS
|
|
- name: Publish release
|
|
env:
|
|
TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
run: |
|
|
set -eu
|
|
api="$GITHUB_SERVER_URL/api/v1/repos/$GITHUB_REPOSITORY"
|
|
if curl -fsS -o /dev/null -H "Authorization: token $TOKEN" "$api/releases/tags/$GITHUB_REF_NAME"; then
|
|
echo "Release $GITHUB_REF_NAME exists already; delete it to publish again." >&2
|
|
exit 1
|
|
fi
|
|
go run ./tools/release notes -json "$GITHUB_REF_NAME" > release.json
|
|
id="$(curl -fsS -X POST -H "Authorization: token $TOKEN" -H "Content-Type: application/json" \
|
|
--data-binary @release.json "$api/releases" | grep -o '"id":[0-9]*' | head -n1 | cut -d: -f2)"
|
|
for f in dist/*.tar.gz dist/*.tgz dist/sbom.spdx.json dist/SHA256SUMS dist/SHA256SUMS.minisig; do
|
|
[ -f "$f" ] || continue
|
|
curl -fsS -o /dev/null -X POST -H "Authorization: token $TOKEN" \
|
|
-F "attachment=@$f" "$api/releases/$id/assets?name=$(basename "$f")"
|
|
done
|
|
# helm repo add uptimesebi <server>/api/packages/<owner>/helm
|
|
- name: Publish Helm chart
|
|
env:
|
|
PACKAGE_TOKEN: ${{ secrets.PACKAGE_TOKEN }}
|
|
run: |
|
|
if [ -z "$PACKAGE_TOKEN" ]; then
|
|
echo "::warning::PACKAGE_TOKEN is not set; the chart is only attached to the release."
|
|
exit 0
|
|
fi
|
|
owner="$(printf '%s' "${GITHUB_REPOSITORY%/*}" | tr 'A-Z' 'a-z')"
|
|
curl -fsS --user "$GITHUB_ACTOR:$PACKAGE_TOKEN" -X POST --upload-file dist/uptimesebi-*.tgz \
|
|
"$GITHUB_SERVER_URL/api/packages/$owner/helm/api/charts"
|