mirror of https://github.com/aminya/setup-cpp
feat: check for the setup-cpp updates and notify
This commit is contained in:
parent
6e6418d7b6
commit
67e7d24a8b
|
@ -7,4 +7,3 @@ stats.html
|
||||||
src/python/setup-python/
|
src/python/setup-python/
|
||||||
src/msvc/msvc-dev-cmd/
|
src/msvc/msvc-dev-cmd/
|
||||||
dev/cpp_vcpkg_project
|
dev/cpp_vcpkg_project
|
||||||
package.json
|
|
||||||
|
|
11
package.json
11
package.json
|
@ -59,6 +59,9 @@
|
||||||
"test.unit": "jest --runInBand"
|
"test.unit": "jest --runInBand"
|
||||||
},
|
},
|
||||||
"prettier": "prettier-config-atomic",
|
"prettier": "prettier-config-atomic",
|
||||||
|
"dependencies": {
|
||||||
|
"update-notifier": "^6.0.2"
|
||||||
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@actions/core": "^1.10.0",
|
"@actions/core": "^1.10.0",
|
||||||
"@actions/exec": "^1.1.1",
|
"@actions/exec": "^1.1.1",
|
||||||
|
@ -153,7 +156,9 @@
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12.x"
|
"node": ">=12.x"
|
||||||
},
|
},
|
||||||
"includeNodeModules": true,
|
"includeNodeModules": {
|
||||||
|
"update-notifier": false
|
||||||
|
},
|
||||||
"optimize": true,
|
"optimize": true,
|
||||||
"outputFormat": "commonjs"
|
"outputFormat": "commonjs"
|
||||||
},
|
},
|
||||||
|
@ -162,7 +167,9 @@
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16.x"
|
"node": ">=16.x"
|
||||||
},
|
},
|
||||||
"includeNodeModules": true,
|
"includeNodeModules": {
|
||||||
|
"update-notifier": false
|
||||||
|
},
|
||||||
"optimize": true,
|
"optimize": true,
|
||||||
"outputFormat": "commonjs"
|
"outputFormat": "commonjs"
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
import { warning } from "ci-log"
|
||||||
|
import { readFile } from "fs/promises"
|
||||||
|
import { join } from "path"
|
||||||
|
|
||||||
|
// auto self update notifier
|
||||||
|
export async function checkUpdates() {
|
||||||
|
try {
|
||||||
|
const updateNotifier = (await import("update-notifier")).default
|
||||||
|
const packageJsonString = await readFile(join(__dirname, "..", "package.json"), "utf8")
|
||||||
|
const packageJson = JSON.parse(packageJsonString)
|
||||||
|
updateNotifier({ pkg: packageJson }).notify()
|
||||||
|
} catch (err) {
|
||||||
|
warning(`Failed to check for updates: ${err}`)
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,6 +16,7 @@ import { untildifyUser } from "untildify-user"
|
||||||
import { setupBazel } from "./bazel/bazel"
|
import { setupBazel } from "./bazel/bazel"
|
||||||
import { setupBrew } from "./brew/brew"
|
import { setupBrew } from "./brew/brew"
|
||||||
import { setupCcache } from "./ccache/ccache"
|
import { setupCcache } from "./ccache/ccache"
|
||||||
|
import { checkUpdates } from "./check-updates"
|
||||||
import { setupChocolatey } from "./chocolatey/chocolatey"
|
import { setupChocolatey } from "./chocolatey/chocolatey"
|
||||||
import { setupCmake } from "./cmake/cmake"
|
import { setupCmake } from "./cmake/cmake"
|
||||||
import { setupConan } from "./conan/conan"
|
import { setupConan } from "./conan/conan"
|
||||||
|
@ -89,7 +90,9 @@ const inputs: Array<Inputs> = ["compiler", "architecture", ...tools]
|
||||||
|
|
||||||
/** The main entry function */
|
/** The main entry function */
|
||||||
export async function main(args: string[]): Promise<number> {
|
export async function main(args: string[]): Promise<number> {
|
||||||
|
let checkUpdatePromise = Promise.resolve()
|
||||||
if (!GITHUB_ACTIONS) {
|
if (!GITHUB_ACTIONS) {
|
||||||
|
checkUpdatePromise = checkUpdates()
|
||||||
process.env.ACTIONS_ALLOW_UNSECURE_COMMANDS = "true"
|
process.env.ACTIONS_ALLOW_UNSECURE_COMMANDS = "true"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,8 +300,11 @@ export async function main(args: string[]): Promise<number> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await checkUpdatePromise
|
||||||
|
|
||||||
return errorMessages.length === 0 ? 0 : 1 // exit with non-zero if any error message
|
return errorMessages.length === 0 ? 0 : 1 // exit with non-zero if any error message
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run main
|
// Run main
|
||||||
main(process.argv)
|
main(process.argv)
|
||||||
.then((ret) => {
|
.then((ret) => {
|
||||||
|
|
Loading…
Reference in New Issue