Skip to content

OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.

ci: every main build ships its CLI as a pre-release; releases promote it

Carl-Gerhard Lindesvärd4ee8296cb92a
diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml
index 064ad758d..6866c8718 100644
--- a/.github/workflows/docker-build.yml
+++ b/.github/workflows/docker-build.yml
@@ -144,6 +144,14 @@ jobs:
- name: Run tests
run: bun run test
+ # The self-hosting CLI keeps its own lockfile (it ships as a binary, not
+ # as a workspace package), so it installs and tests on its own.
+ - name: Test the self-hosting CLI
+ working-directory: self-hosting/cli
+ run: |
+ bun install --frozen-lockfile
+ bun test
+
# Debounce for main: a push within a minute of the previous one cancels its
# wait, so a burst of merges is built and versioned once, as its newest
# commit. `[release now]` in the pushed commit, or a manual run, skips the wait.
@@ -491,3 +499,49 @@ jobs:
run: |
git tag "v$VERSION" "$GITHUB_SHA"
git push origin "v$VERSION"
+
+ # Linux only: self-hosting runs on Linux servers, and bun cross-compiles
+ # both architectures here in seconds.
+ - name: Build the CLI
+ if: steps.next.outputs.skip != 'true'
+ working-directory: self-hosting/cli
+ env:
+ VERSION: ${{ steps.next.outputs.version }}
+ run: |
+ set -euo pipefail
+ bun install --frozen-lockfile
+ for target in linux-x64 linux-arm64; do
+ bun build --compile --target="bun-$target" --define "OPENPANEL_RELEASE_VERSION=\"$VERSION\"" src/main.ts --outfile "dist/openpanel-$target"
+ done
+ test "$(./dist/openpanel-linux-x64 --version)" = "$VERSION"
+ (cd dist && sha256sum openpanel-* > checksums.txt)
+
+ # Supporters install and self-update from these; public installs ignore
+ # pre-releases until the self-hosting tag promotes one.
+ - name: Publish the build as a pre-release
+ if: steps.next.outputs.skip != 'true'
+ env:
+ GH_TOKEN: ${{ github.token }}
+ VERSION: ${{ steps.next.outputs.version }}
+ run: |
+ set -euo pipefail
+ files=(self-hosting/cli/dist/openpanel-* self-hosting/cli/dist/checksums.txt)
+ if gh release view "v$VERSION" >/dev/null 2>&1; then
+ gh release upload "v$VERSION" "${files[@]}" --clobber
+ else
+ gh release create "v$VERSION" "${files[@]}" --verify-tag --prerelease \
+ --title "OpenPanel $VERSION (build)" \
+ --notes "Build of main at $GITHUB_SHA. Supporters get it with \`openpanel upgrade --supporter\`; public releases are published from the self-hosting tag."
+ fi
+
+ # One pre-release per build adds up; keep the newest ten. Tags stay, and a
+ # public release is never a pre-release, so it is never touched.
+ - name: Remove old pre-releases
+ if: steps.next.outputs.skip != 'true'
+ env:
+ GH_TOKEN: ${{ github.token }}
+ KEEP: "10"
+ run: |
+ gh release list --limit 200 --json tagName,isPrerelease,createdAt \
+ --jq "[.[] | select(.isPrerelease)] | sort_by(.createdAt) | reverse | .[$KEEP:] | .[].tagName" \
+ | while read -r tag; do gh release delete "$tag" --yes; done
diff --git a/.github/workflows/self-hosting-release.yml b/.github/workflows/self-hosting-release.yml
index 81d3d9d7b..0778333ce 100644
--- a/.github/workflows/self-hosting-release.yml
+++ b/.github/workflows/self-hosting-release.yml
@@ -4,9 +4,9 @@ name: Self-hosting release
# that commit was built as on main:
# 1. its v* tag says which version it is (commits main never built have none)
# 2. the images main already built and smoke-tested are copied to Docker Hub
-# 3. the CLI is built for every platform, stamped with the same version
-# 4. GPT-6 Astra writes the notes for everything since the previous public release
-# 5. a GitHub release `vX.Y.Z` carries the notes, the CLI and checksums.txt
+# 3. GPT-6 Astra writes the notes for everything since the previous public release
+# 4. the build's pre-release `vX.Y.Z` (the CLI main built next to those images)
+# becomes the public release, with the notes, marked latest
# That release is what `openpanel upgrade` and install.sh look for, and the
# previous one is where the next release's notes start.
on:
@@ -111,58 +111,6 @@ jobs:
echo "$target: $VERSION, $MINOR, $MAJOR, latest"
done
- cli:
- needs: resolve
- permissions:
- contents: read
- strategy:
- matrix:
- include:
- - { target: linux-x64, runner: ubuntu-latest, smoke: true }
- - { target: linux-arm64, runner: ubuntu-latest, smoke: false }
- # Built and signed on macOS: an unsigned binary is killed on launch
- # on Apple Silicon.
- - { target: darwin-arm64, runner: macos-latest, smoke: true }
- - { target: darwin-x64, runner: macos-latest, smoke: false }
- runs-on: ${{ matrix.runner }}
- defaults:
- run:
- working-directory: self-hosting/cli
- steps:
- - uses: actions/checkout@v4
-
- - uses: oven-sh/setup-bun@v2
- with:
- bun-version-file: ".bun-version"
-
- - run: bun install --frozen-lockfile
-
- - run: bun test
-
- - name: Build
- env:
- VERSION: ${{ needs.resolve.outputs.version }}
- run: bun build --compile --target="bun-${{ matrix.target }}" --define "OPENPANEL_RELEASE_VERSION=\"$VERSION\"" src/main.ts --outfile "dist/openpanel-${{ matrix.target }}"
-
- - name: Sign (ad hoc)
- if: runner.os == 'macOS'
- run: |
- codesign --force --sign - "dist/openpanel-${{ matrix.target }}"
- codesign --verify --verbose "dist/openpanel-${{ matrix.target }}"
-
- # Only where the runner can execute the target natively.
- - name: Smoke test
- if: matrix.smoke
- env:
- VERSION: ${{ needs.resolve.outputs.version }}
- run: test "$("./dist/openpanel-${{ matrix.target }}" --version)" = "$VERSION"
-
- - uses: actions/upload-artifact@v4
- with:
- name: openpanel-${{ matrix.target }}
- path: self-hosting/cli/dist/openpanel-${{ matrix.target }}
- if-no-files-found: error
-
notes:
needs: resolve
runs-on: ubuntu-latest
@@ -193,34 +141,57 @@ jobs:
path: release-notes.md
if-no-files-found: error
+ # Promotes, never rebuilds: the CLI supporters already ran is the one that
+ # ships. Only if that build's pre-release was cleaned up (releasing an older
+ # build) is the CLI rebuilt, from the same commit.
publish:
- needs: [resolve, images, cli, notes]
+ needs: [resolve, images, notes]
runs-on: ubuntu-latest
permissions:
contents: write
+ env:
+ GH_TOKEN: ${{ github.token }}
+ VERSION: ${{ needs.resolve.outputs.version }}
steps:
- - uses: actions/download-artifact@v4
- with:
- path: dist
- pattern: openpanel-*
- merge-multiple: true
+ - uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: release-notes
- - name: Checksums
- working-directory: dist
+ - name: Find the build's pre-release
+ id: build
run: |
- chmod +x openpanel-*
- sha256sum openpanel-* > checksums.txt
- cat checksums.txt
+ if gh release view "v$VERSION" --json assets --jq '.assets[].name' 2>/dev/null | grep -qx checksums.txt; then
+ echo "exists=true" >> "$GITHUB_OUTPUT"
+ else
+ echo "exists=false" >> "$GITHUB_OUTPUT"
+ fi
+
+ - uses: oven-sh/setup-bun@v2
+ if: steps.build.outputs.exists != 'true'
+ with:
+ bun-version-file: ".bun-version"
+
+ - name: Rebuild the CLI
+ if: steps.build.outputs.exists != 'true'
+ working-directory: self-hosting/cli
+ run: |
+ set -euo pipefail
+ bun install --frozen-lockfile
+ for target in linux-x64 linux-arm64; do
+ bun build --compile --target="bun-$target" --define "OPENPANEL_RELEASE_VERSION=\"$VERSION\"" src/main.ts --outfile "dist/openpanel-$target"
+ done
+ test "$(./dist/openpanel-linux-x64 --version)" = "$VERSION"
+ (cd dist && sha256sum openpanel-* > checksums.txt)
+ files=(dist/openpanel-* dist/checksums.txt)
+ if gh release view "v$VERSION" >/dev/null 2>&1; then
+ gh release upload "v$VERSION" "${files[@]}" --clobber
+ else
+ gh release create "v$VERSION" "${files[@]}" --verify-tag --prerelease --title "OpenPanel $VERSION" --notes "pending"
+ fi
- name: Publish the release
- env:
- GH_TOKEN: ${{ github.token }}
- VERSION: ${{ needs.resolve.outputs.version }}
run: |
- gh release create "v$VERSION" dist/openpanel-* dist/checksums.txt \
- --repo "$GITHUB_REPOSITORY" --verify-tag --latest \
+ gh release edit "v$VERSION" --prerelease=false --latest \
--title "OpenPanel $VERSION" --notes-file release-notes.md
diff --git a/apps/public/content/docs/self-hosting/deploy-docker-compose.mdx b/apps/public/content/docs/self-hosting/deploy-docker-compose.mdx
index 76863f85e..032e229a5 100644
--- a/apps/public/content/docs/self-hosting/deploy-docker-compose.mdx
+++ b/apps/public/content/docs/self-hosting/deploy-docker-compose.mdx
@@ -19,7 +19,7 @@ This guide will help you deploy OpenPanel using Docker Compose. This method give
- Basic knowledge of command line
<Callout>
-🙋‍♂️ This works on any Linux or macOS machine that can run Docker. You don't need Node, npm or git.
+🙋‍♂️ This works on any Linux server (x64 or arm64) that can run Docker. You don't need Node, npm or git.
</Callout>
## Quick Start
@@ -32,7 +32,7 @@ This guide will help you deploy OpenPanel using Docker Compose. This method give
curl -fsSL https://raw.githubusercontent.com/Openpanel-dev/openpanel/main/self-hosting/install.sh | sh
```
-This downloads a single `openpanel` binary, verifies its checksum and puts it on your `PATH`. Builds for Linux and macOS (x64 and arm64) are also on the [releases page](https://github.com/Openpanel-dev/openpanel/releases).
+This downloads a single `openpanel` binary, verifies its checksum and puts it on your `PATH`. Builds for Linux (x64 and arm64) are also on the [releases page](https://github.com/Openpanel-dev/openpanel/releases).
</Step>
<Step>
diff --git a/apps/public/content/docs/self-hosting/self-hosting.mdx b/apps/public/content/docs/self-hosting/self-hosting.mdx
index 1680034ae..047151135 100644
--- a/apps/public/content/docs/self-hosting/self-hosting.mdx
+++ b/apps/public/content/docs/self-hosting/self-hosting.mdx
@@ -14,7 +14,7 @@ import { SelfHostingVersionBanner } from '@/components/self-hosting-version-bann
- A VPS of any kind (only tested on Ubuntu 24.04)
- We recommend using [Hetzner (affiliate link)](https://hetzner.cloud/?ref=7Hq0H5mQh7tM). Use the link if you want to support us. 🫶
- - 🙋‍♂️ This works on any Linux or macOS machine that can run Docker. The CLI offers to install Docker for you on Linux.
+ - 🙋‍♂️ This works on any Linux server (x64 or arm64) that can run Docker. The CLI offers to install Docker for you.
- At least 4GB RAM (Redpanda, ClickHouse and Postgres run side by side)
- A domain name pointing at the server, if you want automatic HTTPS
@@ -36,7 +36,7 @@ The `openpanel` CLI is a single file with no dependencies. The script downloads
curl -fsSL https://raw.githubusercontent.com/Openpanel-dev/openpanel/main/self-hosting/install.sh | sh
```
-You can also download a binary from the [releases page](https://github.com/Openpanel-dev/openpanel/releases): every OpenPanel release includes the CLI for Linux and macOS, with a `checksums.txt`.
+You can also download a binary from the [releases page](https://github.com/Openpanel-dev/openpanel/releases): every OpenPanel release includes the CLI for Linux (x64 and arm64), with a `checksums.txt`.
</Step>
<Step>
### Run the setup
diff --git a/apps/public/content/docs/self-hosting/supporter-access-latest-docker-images.mdx b/apps/public/content/docs/self-hosting/supporter-access-latest-docker-images.mdx
index a76ba1559..802319589 100644
--- a/apps/public/content/docs/self-hosting/supporter-access-latest-docker-images.mdx
+++ b/apps/public/content/docs/self-hosting/supporter-access-latest-docker-images.mdx
@@ -59,13 +59,23 @@ Replace `your_api_key` with the actual API key provided to you.
Make sure to keep your API key secure and never commit it to version control!
</Callout>
-### Step 4: Switch to the latest images
+### Step 4: Install the CLI
+
+Every build comes with a matching `openpanel` CLI. Install the newest build on your server:
+
+```bash
+curl -fsSL https://raw.githubusercontent.com/Openpanel-dev/openpanel/main/self-hosting/install.sh | OPENPANEL_CHANNEL=supporter sh
+```
+
+Already have the CLI from a public release? Skip this; the next step updates it.
+
+### Step 5: Switch to the latest images
```bash
openpanel upgrade --supporter
```
-This checks that you're logged in to `docker.openpanel.dev`, finds the newest build (every push to our main branch gets a version such as `3.1.9`), points your install at it, and restarts. It shows every change and asks before writing anything.
+This updates the CLI to the newest build, checks that you're logged in to `docker.openpanel.dev`, finds the newest build (every push to our main branch gets a version such as `3.1.9`), points your install at it, and restarts. It shows every change and asks before writing anything.
Don't have the CLI yet? See [Get started with self-hosting](/docs/self-hosting/self-hosting#quickstart).