Fix: Upload Artifact issue (#5271)

This commit is contained in:
Louis Lam 2024-10-29 22:10:05 +08:00 committed by GitHub
parent 06a272c119
commit 0254e72177
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 51 additions and 5 deletions

View File

@ -62,4 +62,4 @@ buildImage(repoName, [ "beta", version ], "release");
await pressAnyKey(); await pressAnyKey();
// npm run upload-artifacts // npm run upload-artifacts
uploadArtifacts(); uploadArtifacts(version, githubToken);

View File

@ -51,7 +51,7 @@ buildImage(repoName, [ "next", "2", version ], "release");
await pressAnyKey(); await pressAnyKey();
// npm run upload-artifacts // npm run upload-artifacts
uploadArtifacts(); uploadArtifacts(version, githubToken);
// node extra/update-wiki-version.js // node extra/update-wiki-version.js
execSync("node extra/update-wiki-version.js"); execSync("node extra/update-wiki-version.js");

View File

@ -171,10 +171,43 @@ export function ver(version, identifier) {
/** /**
* Upload artifacts to GitHub * Upload artifacts to GitHub
* docker buildx build -f docker/dockerfile --platform linux/amd64 -t louislam/uptime-kuma:upload-artifact --build-arg VERSION --build-arg GITHUB_TOKEN --target upload-artifact . --progress plain
* @param {string} version Version
* @param {string} githubToken GitHub token
* @returns {void} * @returns {void}
*/ */
export function uploadArtifacts() { export function uploadArtifacts(version, githubToken) {
execSync("npm run upload-artifacts"); let args = [
"buildx",
"build",
"-f",
"docker/dockerfile",
"--platform",
"linux/amd64",
"-t",
"louislam/uptime-kuma:upload-artifact",
"--build-arg",
`VERSION=${version}`,
"--build-arg",
"GITHUB_TOKEN",
"--target",
"upload-artifact",
".",
"--progress",
"plain",
];
if (!dryRun) {
childProcess.spawnSync("docker", args, {
stdio: "inherit",
env: {
...process.env,
GITHUB_TOKEN: githubToken,
},
});
} else {
console.log(`[DRY RUN] docker ${args.join(" ")}`);
}
} }
/** /**

View File

@ -0,0 +1,6 @@
import { uploadArtifacts } from "./lib.mjs";
const version = process.env.RELEASE_BETA_VERSION;
const githubToken = process.env.RELEASE_GITHUB_TOKEN;
uploadArtifacts(version, githubToken);

View File

@ -0,0 +1,6 @@
import { uploadArtifacts } from "./lib.mjs";
const version = process.env.RELEASE_VERSION;
const githubToken = process.env.RELEASE_GITHUB_TOKEN;
uploadArtifacts(version, githubToken);

View File

@ -39,7 +39,8 @@
"build-docker-builder-go": "docker buildx build -f docker/builder-go.dockerfile --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:builder-go . --push", "build-docker-builder-go": "docker buildx build -f docker/builder-go.dockerfile --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:builder-go . --push",
"build-docker-nightly-local": "npm run build && docker build -f docker/dockerfile -t louislam/uptime-kuma:nightly2 --target nightly .", "build-docker-nightly-local": "npm run build && docker build -f docker/dockerfile -t louislam/uptime-kuma:nightly2 --target nightly .",
"build-docker-pr-test": "docker buildx build -f docker/dockerfile --platform linux/amd64,linux/arm64 -t louislam/uptime-kuma:pr-test2 --target pr-test2 . --push", "build-docker-pr-test": "docker buildx build -f docker/dockerfile --platform linux/amd64,linux/arm64 -t louislam/uptime-kuma:pr-test2 --target pr-test2 . --push",
"upload-artifacts": "docker buildx build -f docker/dockerfile --platform linux/amd64 -t louislam/uptime-kuma:upload-artifact --build-arg VERSION --build-arg GITHUB_TOKEN --target upload-artifact . --progress plain", "upload-artifacts": "node extra/release/upload-artifacts.mjs",
"upload-artifacts-beta": "node extra/release/upload-artifacts-beta.mjs",
"setup": "git checkout 1.23.15 && npm ci --production && npm run download-dist", "setup": "git checkout 1.23.15 && npm ci --production && npm run download-dist",
"download-dist": "node extra/download-dist.js", "download-dist": "node extra/download-dist.js",
"mark-as-nightly": "node extra/mark-as-nightly.js", "mark-as-nightly": "node extra/mark-as-nightly.js",