Fix workflow and add warning to latest docker tag (#7849)

This commit is contained in:
Louis Lam authored and GitHub committed 2026-09-16 11:49:40 +00:00
1 parent b4738c5203
commit 2340d4380b
6 files changed
+115 -13

No files matched your search

+15 -7
View File
@@ -17,12 +17,20 @@ jobs:
permissions:
contents: write
pull-requests: write
strategy:
fail-fast: false
matrix:
include:
- branch: master
update_branch: npm-update
- branch: 2.5.X
update_branch: npm-update-2.5.X
steps:
- name: Checkout master branch
- name: Checkout ${{ matrix.branch }} branch
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: master
ref: ${{ matrix.branch }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js
@@ -59,10 +67,10 @@ jobs:
git add package-lock.json
git commit -m "chore: Update dependencies"
- name: Force push to npm-update branch
- name: Force push to ${{ matrix.update_branch }} branch
if: steps.check_changes.outputs.has_changes == 'true'
run: |
git push -f origin HEAD:npm-update
git push -f origin HEAD:${{ matrix.update_branch }}
- name: Check if PR exists
if: steps.check_changes.outputs.has_changes == 'true'
@@ -70,7 +78,7 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PR_EXISTS=$(gh pr list --base master --head npm-update --json number --jq 'length')
PR_EXISTS=$(gh pr list --base ${{ matrix.branch }} --head ${{ matrix.update_branch }} --json number --jq 'length')
if [ "$PR_EXISTS" -eq "0" ]; then
echo "pr_exists=false" >> $GITHUB_OUTPUT
else
@@ -83,7 +91,7 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr create \
--base master \
--head npm-update \
--base ${{ matrix.branch }} \
--head ${{ matrix.update_branch }} \
--title "chore: Update dependencies" \
--body ""
+11 -4
View File
@@ -4,7 +4,7 @@ on:
workflow_dispatch:
inputs:
version:
description: "Release version number (e.g., 2.1.0, or 2.1.0-beta.2 for beta)"
description: "Release version number (e.g., 2.5.5, or 2.5.5-beta.2 for beta). NOTE: Releasing 3.0.0 is NOT supported yet, this workflow currently releases the 2.5.X branch only."
required: true
type: string
previous_version:
@@ -38,8 +38,11 @@ jobs:
timeout-minutes: 20
steps:
# TODO: temporarily pinned to 2.5.X because master is 3.0.0 and not ready to be released yet.
# Remove this ref (and RELEASE_BASE_BRANCH below) once 3.0.0 is ready.
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: 2.5.X
persist-credentials: true
fetch-depth: 0 # Fetch all history and tags for update-version
@@ -64,6 +67,7 @@ jobs:
RELEASE_VERSION: ${{ inputs.version }}
RELEASE_IS_BETA: ${{ inputs.is_beta }}
RELEASE_PREVIOUS_VERSION: ${{ inputs.previous_version }}
RELEASE_BASE_BRANCH: "2.5.X"
DRY_RUN: ${{ inputs.dry_run }}
GH_TOKEN: ${{ github.token }}
GITHUB_RUN_ID: ${{ github.run_id }}
@@ -76,7 +80,7 @@ jobs:
outputs:
pr_number: ${{ steps.pr.outputs.pr_number }}
# 2. Squash merge the release PR into master
# 2. Squash merge the release PR into the release base branch (2.5.X for now, normally master)
# Re-runnable: skips if the PR is already merged
merge-pr:
needs: prepare
@@ -121,8 +125,10 @@ jobs:
timeout-minutes: 30
steps:
# TODO: temporarily pinned to 2.5.X, see the prepare job
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: 2.5.X
persist-credentials: false
fetch-depth: 0 # Fetch all history and tags for changelog generation
@@ -142,6 +148,7 @@ jobs:
RELEASE_VERSION: ${{ inputs.version }}
RELEASE_IS_BETA: ${{ inputs.is_beta }}
RELEASE_PREVIOUS_VERSION: ${{ inputs.previous_version }}
RELEASE_BASE_BRANCH: "2.5.X"
DRY_RUN: ${{ inputs.dry_run }}
MERGE_SHA: ${{ needs.merge-pr.outputs.merge_sha }}
GH_TOKEN: ${{ secrets.RELEASE_PAT }}
@@ -157,7 +164,7 @@ jobs:
timeout-minutes: 30
steps:
# Checkout the merged master code (merge_sha), not the workflow-dispatch SHA,
# Checkout the merged release branch code (merge_sha), not the workflow-dispatch SHA,
# so package.json is already bumped to the release version before building.
# Otherwise the frontend FRONTEND_VERSION (from npm_package_version) would be stale.
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
@@ -195,7 +202,7 @@ jobs:
path: ./tmp/dist.tar.gz
retention-days: 90
# 5. Build and push all docker images from the merged master, reusing the dist
# 5. Build and push all docker images from the merged release branch, reusing the dist
# built by build-and-upload-assets (the frontend is never rebuilt here)
# Re-runnable: partial pushes are overwritten safely
docker-images:
@@ -0,0 +1,8 @@
# Build and push (multi arch):
# docker buildx build -f Dockerfile.latest-warning --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:latest -t louislam/uptime-kuma:1 --push .
FROM louislam/uptime-kuma:1.23.17-debian
COPY docker-latest-warning.js /app/dist/docker-latest-warning.js
RUN rm -f /app/dist/index.html.gz /app/dist/index.html.br \
&& sed -i 's#</head>#<script src="/docker-latest-warning.js"></script></head>#' /app/dist/index.html \
&& grep -q "docker-latest-warning.js" /app/dist/index.html
@@ -0,0 +1,71 @@
// Injected into the legacy `latest` / `1` Docker images.
(() => {
const isSetupPage = () => location.pathname === "/setup" || location.pathname.startsWith("/setup/");
let acknowledged = false;
let overlay = null;
let styleAdded = false;
const show = () => {
if (acknowledged || overlay || !isSetupPage()) {
return;
}
if (!styleAdded) {
const style = document.createElement("style");
style.textContent = ".uk-latest-warning { position: fixed; inset: 0; z-index: 2147483647; }";
document.documentElement.appendChild(style);
styleAdded = true;
}
overlay = document.createElement("div");
overlay.className =
"uk-latest-warning d-flex align-items-center justify-content-center p-3 bg-dark text-white overflow-auto";
overlay.innerHTML = `
<div style="max-width: 640px;">
<h3 class="mb-3">⚠️ This Uptime Kuma version is outdated!</h3>
<p>
Current Version: 1.23.17 (Outdated!)
</p>
<p>
You are running the <code>latest</code> tag, which still points to Uptime Kuma v1.
It is NO LONGER maintained and does not receive any bug or security fixes.
</p>
<p>
Please switch to a recommended tag, to get the latest version and security updates.
</p>
<p class="mb-4">
Read more:
<a class="link-light" href="https://github.com/louislam/uptime-kuma/wiki/Docker-Tags" target="_blank" rel="noopener noreferrer">Recommended Docker Tags</a>
</p>
<button type="button" class="btn btn-danger">Ignore and continue with the old version</button>
</div>
`;
overlay.querySelector("button").addEventListener("click", () => {
acknowledged = true;
overlay.remove();
overlay = null;
});
document.documentElement.appendChild(overlay);
};
// The app redirects to /setup with the client-side router, so watch for route changes.
for (const method of ["pushState", "replaceState"]) {
const original = history[method];
history[method] = function () {
const result = original.apply(history, arguments);
show();
return result;
};
}
window.addEventListener("popstate", show);
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", show);
} else {
show();
}
})();
+8
View File
@@ -0,0 +1,8 @@
{
"name": "docker-latest-warning",
"private": true,
"scripts": {
"build": "docker build -f Dockerfile.latest-warning -t louislam/uptime-kuma:latest-warning-test .",
"multi-build-and-push": "docker buildx build -f Dockerfile.latest-warning --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:latest -t louislam/uptime-kuma:1 --push ."
}
}
+2 -2
View File
@@ -10,7 +10,7 @@ checkDocker();
buildDist();
// Build full image (rootless)
buildImage(repoNames, ["nightly3-rootless"], "nightly-rootless");
buildImage(repoNames, ["nightly3-rootless", "nightly-rootless"], "nightly-rootless");
// Build full image
buildImage(repoNames, ["nightly3"], "nightly");
buildImage(repoNames, ["nightly3", "nightly"], "nightly");