Add checkout pr logic

This commit is contained in:
Louis Lam 2022-09-03 18:37:31 +08:00
parent e0cdc3e7c5
commit fd2df562b1
3 changed files with 16 additions and 4 deletions

View File

@ -45,14 +45,14 @@ RUN rm -rf ./* && chown node /app
USER node
RUN git clone https://github.com/louislam/uptime-kuma.git .
RUN git clone https://github.com/louislam/uptime-kuma.git \
RUN gh pr checkout 2023
RUN npm ci
EXPOSE 3000 3001
VOLUME ["/app/data"]
HEALTHCHECK --interval=60s --timeout=30s --start-period=180s --retries=5 CMD node extra/healthcheck.js
ENTRYPOINT ["/usr/bin/dumb-init", "--", "extra/entrypoint.sh"]
CMD ["npm", "run", "dev"]
CMD ["npm", "run", "start-pr-test"]
# Upload the artifact to Github

11
extra/checkout-pr.js Normal file
View File

@ -0,0 +1,11 @@
const childProcess = require("child_process");
if (!process.env.UPTIME_KUMA_PRUPTIME_KUMA_PR) {
console.error("Please set a pull request number to the environment variable 'UPTIME_KUMA_PRUPTIME_KUMA_PR'");
process.exit(1);
}
console.log("Checkout pr");
// Checkout the pr
childProcess.spawnSync("gh", [ "pr", "checkout", process.env.UPTIME_KUMA_PR ]);

View File

@ -59,7 +59,8 @@
"release-final": "node extra/update-version.js && npm run build-docker && node ./extra/press-any-key.js && npm run upload-artifacts && node ./extra/update-wiki-version.js",
"release-beta": "node extra/beta/update-version.js && npm run build && node ./extra/env2arg.js docker buildx build -f docker/dockerfile --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:$VERSION -t louislam/uptime-kuma:beta . --target release --push && node ./extra/press-any-key.js && npm run upload-artifacts",
"git-remove-tag": "git tag -d",
"build-dist-and-restart": "npm run build && npm run start-server-dev"
"build-dist-and-restart": "npm run build && npm run start-server-dev",
"start-pr-test": "node extra/checkout-pr.js && npm install && npm run dev"
},
"dependencies": {
"@louislam/sqlite3": "~15.0.6",