forked from louislam/uptime-kuma
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
81 changed files
with
12,660 additions
and
7,839 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
-- You should not modify if this have pushed to Github, unless it does serious wrong with the db. | ||
BEGIN TRANSACTION; | ||
|
||
CREATE TABLE [status_page]( | ||
[id] INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, | ||
[slug] VARCHAR(255) NOT NULL UNIQUE, | ||
[title] VARCHAR(255) NOT NULL, | ||
[description] TEXT, | ||
[icon] VARCHAR(255) NOT NULL, | ||
[theme] VARCHAR(30) NOT NULL, | ||
[published] BOOLEAN NOT NULL DEFAULT 1, | ||
[search_engine_index] BOOLEAN NOT NULL DEFAULT 1, | ||
[show_tags] BOOLEAN NOT NULL DEFAULT 0, | ||
[password] VARCHAR, | ||
[created_date] DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
[modified_date] DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP | ||
); | ||
|
||
CREATE UNIQUE INDEX [slug] ON [status_page]([slug]); | ||
|
||
|
||
CREATE TABLE [status_page_cname]( | ||
[id] INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, | ||
[status_page_id] INTEGER NOT NULL REFERENCES [status_page]([id]) ON DELETE CASCADE ON UPDATE CASCADE, | ||
[domain] VARCHAR NOT NULL UNIQUE | ||
); | ||
|
||
ALTER TABLE incident ADD status_page_id INTEGER; | ||
ALTER TABLE [group] ADD status_page_id INTEGER; | ||
|
||
COMMIT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
const pkg = require("../../package.json"); | ||
const fs = require("fs"); | ||
const child_process = require("child_process"); | ||
const util = require("../../src/util"); | ||
|
||
util.polyfill(); | ||
|
||
const oldVersion = pkg.version; | ||
const version = process.env.VERSION; | ||
|
||
console.log("Beta Version: " + version); | ||
|
||
if (!oldVersion || oldVersion.includes("-beta.")) { | ||
console.error("Error: old version should not be a beta version?"); | ||
process.exit(1); | ||
} | ||
|
||
if (!version || !version.includes("-beta.")) { | ||
console.error("invalid version, beta version only"); | ||
process.exit(1); | ||
} | ||
|
||
const exists = tagExists(version); | ||
|
||
if (! exists) { | ||
// Process package.json | ||
pkg.version = version; | ||
fs.writeFileSync("package.json", JSON.stringify(pkg, null, 4) + "\n"); | ||
commit(version); | ||
tag(version); | ||
|
||
} else { | ||
console.log("version tag exists, please delete the tag or use another tag"); | ||
process.exit(1); | ||
} | ||
|
||
function commit(version) { | ||
let msg = "Update to " + version; | ||
|
||
let res = child_process.spawnSync("git", ["commit", "-m", msg, "-a"]); | ||
let stdout = res.stdout.toString().trim(); | ||
console.log(stdout); | ||
|
||
if (stdout.includes("no changes added to commit")) { | ||
throw new Error("commit error"); | ||
} | ||
|
||
res = child_process.spawnSync("git", ["push", "origin", "master"]); | ||
console.log(res.stdout.toString().trim()); | ||
} | ||
|
||
function tag(version) { | ||
let res = child_process.spawnSync("git", ["tag", version]); | ||
console.log(res.stdout.toString().trim()); | ||
|
||
res = child_process.spawnSync("git", ["push", "origin", version]); | ||
console.log(res.stdout.toString().trim()); | ||
} | ||
|
||
function tagExists(version) { | ||
if (! version) { | ||
throw new Error("invalid version"); | ||
} | ||
|
||
let res = child_process.spawnSync("git", ["tag", "-l", version]); | ||
|
||
return res.stdout.toString().trim() === version; | ||
} | ||
|
||
function safeDelete(dir) { | ||
if (fs.existsSync(dir)) { | ||
fs.rmdirSync(dir, { | ||
recursive: true, | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env node | ||
|
||
const childProcess = require("child_process"); | ||
let env = process.env; | ||
|
||
let cmd = process.argv[2]; | ||
let args = process.argv.slice(3); | ||
let replacedArgs = []; | ||
|
||
for (let arg of args) { | ||
for (let key in env) { | ||
arg = arg.replaceAll(`$${key}`, env[key]); | ||
} | ||
replacedArgs.push(arg); | ||
} | ||
|
||
let child = childProcess.spawn(cmd, replacedArgs); | ||
child.stdout.pipe(process.stdout); | ||
child.stderr.pipe(process.stderr); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
console.log("Git Push and Publish the release note on github, then press any key to continue"); | ||
|
||
process.stdin.setRawMode(true); | ||
process.stdin.resume(); | ||
process.stdin.on("data", process.exit.bind(process, 0)); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
const child_process = require("child_process"); | ||
const fs = require("fs"); | ||
|
||
const newVersion = process.env.VERSION; | ||
|
||
if (!newVersion) { | ||
console.log("Missing version"); | ||
process.exit(1); | ||
} | ||
|
||
updateWiki(newVersion); | ||
|
||
function updateWiki(newVersion) { | ||
const wikiDir = "./tmp/wiki"; | ||
const howToUpdateFilename = "./tmp/wiki/🆙-How-to-Update.md"; | ||
|
||
safeDelete(wikiDir); | ||
|
||
child_process.spawnSync("git", ["clone", "https://github.com/louislam/uptime-kuma.wiki.git", wikiDir]); | ||
let content = fs.readFileSync(howToUpdateFilename).toString(); | ||
|
||
// Replace the version: https://regex101.com/r/hmj2Bc/1 | ||
content = content.replace(/(git checkout )([^\s]+)/, `$1${newVersion}`); | ||
fs.writeFileSync(howToUpdateFilename, content); | ||
|
||
child_process.spawnSync("git", ["add", "-A"], { | ||
cwd: wikiDir, | ||
}); | ||
|
||
child_process.spawnSync("git", ["commit", "-m", `Update to ${newVersion}`], { | ||
cwd: wikiDir, | ||
}); | ||
|
||
console.log("Pushing to Github"); | ||
child_process.spawnSync("git", ["push"], { | ||
cwd: wikiDir, | ||
}); | ||
|
||
safeDelete(wikiDir); | ||
} | ||
|
||
function safeDelete(dir) { | ||
if (fs.existsSync(dir)) { | ||
fs.rmdirSync(dir, { | ||
recursive: true, | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.