diff --git a/package.json b/package.json index ed6b1de417e47fde0a20c32498c1b7df0fdef471..f773a8406c8f0bca62aa8d6ece3ec842159c7148 100644 --- a/package.json +++ b/package.json @@ -173,8 +173,6 @@ "re2": "1.10.5" }, "devDependencies": { - "@actions/core": "1.2.3", - "@actions/exec": "1.0.3", "@babel/cli": "7.8.4", "@babel/core": "7.9.0", "@babel/node": "7.8.7", diff --git a/tools/dispatch-release.mjs b/tools/dispatch-release.mjs index 231262ce4ca5f23cf1be0a04e9ced40338d9b194..2a3f5b250da7d565309fb8427920af42582cb37b 100644 --- a/tools/dispatch-release.mjs +++ b/tools/dispatch-release.mjs @@ -1,5 +1,5 @@ import got from 'got'; -import core from '@actions/core'; +import shell from 'shelljs'; import { program } from './utils.mjs'; const version = program.release; @@ -7,34 +7,32 @@ const dry = program.dryRun; const baseUrl = 'https://api.github.com/'; -export default async function run() { - core.info(`Dispatching version: ${version}`); +shell.echo(`Dispatching version: ${version}`); +(async () => { if (dry) { - core.warning('DRY-RUN: done.'); + shell.echo('DRY-RUN: done.'); return; } - try { - await got(`repos/${process.env.GITHUB_REPOSITORY}/dispatches`, { - baseUrl, - headers: { - 'user-agent': 'Renovate release helper', - authorization: `token ${process.env.GITHUB_TOKEN}`, + await got(`repos/${process.env.GITHUB_REPOSITORY}/dispatches`, { + baseUrl, + headers: { + 'user-agent': 'Renovate release helper', + authorization: `token ${process.env.GITHUB_TOKEN}`, + }, + json: true, + retry: 5, + body: { + event_type: 'renovate-release', + // max 10 keys here, https://github.com/peter-evans/repository-dispatch#client-payload + client_payload: { + sha: process.env.GITHUB_SHA, + ref: process.env.GITHUB_REF, + version, }, - json: true, - retry: 5, - body: { - event_type: 'renovate-release', - // max 10 keys here, https://github.com/peter-evans/repository-dispatch#client-payload - client_payload: { - sha: process.env.GITHUB_SHA, - ref: process.env.GITHUB_REF, - version, - }, - }, - }); - } catch (e) { - // Ignore for now - core.error(e.toString()); - } -} + }, + }); +})().catch(e => { + // Ignore for now + shell.echo(e.toString()); +}); diff --git a/tools/package.json b/tools/package.json index c54deeeac0c678f7d7207fa53527a4fbf7ecab5b..0b98cf51cfa9ec82ce36de1a287b416f7752971c 100644 --- a/tools/package.json +++ b/tools/package.json @@ -2,8 +2,6 @@ "private": true, "type": "module", "dependencies": { - "@actions/core": "1.2.3", - "@actions/exec": "1.0.3", "commander": "4.1.1", "fs-extra": "8.1.0", "got": "9.6.0", diff --git a/tools/release.mjs b/tools/release.mjs index c345dc3ca9f30fc29d697be97aa07214daa38f72..8d8e9e5fb2f271753f2ad09c9b575f7f0b8072b7 100644 --- a/tools/release.mjs +++ b/tools/release.mjs @@ -1,31 +1,29 @@ -import core from '@actions/core'; +import shell from 'shelljs'; import { program, exec } from './utils.mjs'; -import dispatch from './dispatch-release.mjs'; const version = program.release; const sha = program.sha; let err = false; -core.info(`Publishing version: ${version}`); +shell.echo(`Publishing version: ${version}`); -core.info('Publishing npm package ...'); +shell.echo('Publishing npm package ...'); if ( !exec(`npm --no-git-tag-version version ${version}`) || - !exec(`npm publish`, [ - 'You cannot publish over the previously published versions', - ]) + !exec(`npm publish`) ) { err = true; } -core.info('Publishing docker images ...'); +shell.echo('Publishing docker images ...'); if (!exec(`./.github/workflows/release-docker.sh ${version} ${sha}`)) { err = true; } -dispatch(); +// eslint-disable-next-line promise/valid-params +import('./dispatch-release.mjs').catch(); if (err) { - core.setFailed('release failed partially'); + shell.exit(2); } diff --git a/tools/utils.mjs b/tools/utils.mjs index 932384b43600a90fdb340dd5260c353f6140f5d2..49f1e215ffe156226c7a56b991922e5cb5760ddc 100644 --- a/tools/utils.mjs +++ b/tools/utils.mjs @@ -1,5 +1,4 @@ import commander from 'commander'; -import core from '@actions/core'; import shell from 'shelljs'; const program = new commander.Command(); @@ -18,33 +17,16 @@ export { program }; * @param cmd {string} The command to execute * @returns {boolean} Returns true on zero exit code otherwise false */ -export function exec(cmd, ignores = []) { +export function exec(cmd) { try { - if (program.dryRun) { - core.warning(`DRY-RUN: ${cmd}`); - return true; + if (!program.dryRun) { + const res = shell.exec(cmd); + return res.code === 0; } - - core.startGroup(cmd); - const res = shell.exec(cmd); - if (res.code === 0) { - return true; - } - - if ( - ignores.length && - ignores.some(s => res.stdout.includes(s) || res.stderr.includes(s)) - ) { - core.warning(`Ignoring code: ${res.code}`); - return true; - } - - core.warning(`Failed with code: ${res.code}`); - return false; + shell.echo(`DRY-RUN: ${cmd}`); } catch (e) { - core.error(e.toString()); + shell.echo(e.toString()); return false; - } finally { - core.endGroup(cmd); } + return true; } diff --git a/tools/verify.mjs b/tools/verify.mjs index 4e2730a41481413b7dd30143931b8c84c719ca5b..ebc9a62f544e3d7d85479e7563be2be265577916 100644 --- a/tools/verify.mjs +++ b/tools/verify.mjs @@ -1,14 +1,8 @@ -import core from '@actions/core'; -import exec from '@actions/exec'; +import shell from 'shelljs'; -core.info(`Verifying ...`); -(async () => { - try { - core.groupStart('npm whoami'); - await exec.exec(`npm`, ['whoami']); - } catch (e) { - core.setFailed('npm auth error'); - } finally { - core.endGroup('npm whoami'); - } -})(); +shell.echo(`Verifying ...`); + +const res = shell.exec(`npm whoami`); +if (res.code !== 0) { + shell.exit(2); +} diff --git a/yarn.lock b/yarn.lock index f875942541a7219db67b6967fc26aeaf65bbfa5a..0ccee78b3b619c744cb6109171b8f97c26ad4742 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,23 +2,6 @@ # yarn lockfile v1 -"@actions/core@1.2.3": - version "1.2.3" - resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.2.3.tgz#e844b4fa0820e206075445079130868f95bfca95" - integrity sha512-Wp4xnyokakM45Uuj4WLUxdsa8fJjKVl1fDTsPbTEcTcuu0Nb26IPQbOtjmnfaCPGcaoPOOqId8H9NapZ8gii4w== - -"@actions/exec@1.0.3": - version "1.0.3" - resolved "https://registry.yarnpkg.com/@actions/exec/-/exec-1.0.3.tgz#b967f8700d6ff011dcc91243b58bafc1bb9ab95f" - integrity sha512-TogJGnueOmM7ntCi0ASTUj4LapRRtDfj57Ja4IhPmg2fls28uVOPbAn8N+JifaOumN2UG3oEO/Ixek2A4NcYSA== - dependencies: - "@actions/io" "^1.0.1" - -"@actions/io@^1.0.1": - version "1.0.2" - resolved "https://registry.yarnpkg.com/@actions/io/-/io-1.0.2.tgz#2f614b6e69ce14d191180451eb38e6576a6e6b27" - integrity sha512-J8KuFqVPr3p6U8W93DOXlXW6zFvrQAJANdS+vw0YhusLIq+bszW8zmK2Fh1C2kDPX8FMvwIl1OUcFgvJoXLbAg== - "@babel/cli@7.8.4": version "7.8.4" resolved "https://registry.yarnpkg.com/@babel/cli/-/cli-7.8.4.tgz#505fb053721a98777b2b175323ea4f090b7d3c1c" @@ -3095,7 +3078,7 @@ debug@^3.1.0, debug@^3.2.6: dependencies: ms "^2.1.1" -debuglog@^1.0.1: +debuglog@*, debuglog@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492" integrity sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI= @@ -4675,7 +4658,7 @@ import-local@^3.0.2: pkg-dir "^4.2.0" resolve-cwd "^3.0.0" -imurmurhash@^0.1.4: +imurmurhash@*, imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= @@ -5979,6 +5962,11 @@ lockfile@^1.0.4: dependencies: signal-exit "^3.0.2" +lodash._baseindexof@*: + version "3.1.0" + resolved "https://registry.yarnpkg.com/lodash._baseindexof/-/lodash._baseindexof-3.1.0.tgz#fe52b53a1c6761e42618d654e4a25789ed61822c" + integrity sha1-/lK1OhxnYeQmGNZU5KJXie1hgiw= + lodash._baseuniq@~4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/lodash._baseuniq/-/lodash._baseuniq-4.6.0.tgz#0ebb44e456814af7905c6212fa2c9b2d51b841e8" @@ -5987,11 +5975,33 @@ lodash._baseuniq@~4.6.0: lodash._createset "~4.0.0" lodash._root "~3.0.0" +lodash._bindcallback@*: + version "3.0.1" + resolved "https://registry.yarnpkg.com/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz#e531c27644cf8b57a99e17ed95b35c748789392e" + integrity sha1-5THCdkTPi1epnhftlbNcdIeJOS4= + +lodash._cacheindexof@*: + version "3.0.2" + resolved "https://registry.yarnpkg.com/lodash._cacheindexof/-/lodash._cacheindexof-3.0.2.tgz#3dc69ac82498d2ee5e3ce56091bafd2adc7bde92" + integrity sha1-PcaayCSY0u5ePOVgkbr9Ktx73pI= + +lodash._createcache@*: + version "3.1.2" + resolved "https://registry.yarnpkg.com/lodash._createcache/-/lodash._createcache-3.1.2.tgz#56d6a064017625e79ebca6b8018e17440bdcf093" + integrity sha1-VtagZAF2JeeevKa4AY4XRAvc8JM= + dependencies: + lodash._getnative "^3.0.0" + lodash._createset@~4.0.0: version "4.0.3" resolved "https://registry.yarnpkg.com/lodash._createset/-/lodash._createset-4.0.3.tgz#0f4659fbb09d75194fa9e2b88a6644d363c9fe26" integrity sha1-D0ZZ+7CddRlPqeK4imZE02PJ/iY= +lodash._getnative@*, lodash._getnative@^3.0.0: + version "3.9.1" + resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5" + integrity sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U= + lodash._reinterpolate@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d" @@ -6037,6 +6047,11 @@ lodash.isstring@^4.0.1: resolved "https://registry.yarnpkg.com/lodash.isstring/-/lodash.isstring-4.0.1.tgz#d527dfb5456eca7cc9bb95d5daeaf88ba54a5451" integrity sha1-1SfftUVuynzJu5XV2ur4i6VKVFE= +lodash.restparam@*: + version "3.6.1" + resolved "https://registry.yarnpkg.com/lodash.restparam/-/lodash.restparam-3.6.1.tgz#936a4e309ef330a7645ed4145986c85ae5b20805" + integrity sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU= + lodash.sortby@^4.7.0: version "4.7.0" resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" @@ -6962,6 +6977,7 @@ npm@6.14.3, npm@^6.10.3: cmd-shim "^3.0.3" columnify "~1.5.4" config-chain "^1.1.12" + debuglog "*" detect-indent "~5.0.0" detect-newline "^2.1.0" dezalgo "~1.0.3" @@ -6976,6 +6992,7 @@ npm@6.14.3, npm@^6.10.3: has-unicode "~2.0.1" hosted-git-info "^2.8.8" iferr "^1.0.2" + imurmurhash "*" infer-owner "^1.0.4" inflight "~1.0.6" inherits "^2.0.4" @@ -6994,8 +7011,14 @@ npm@6.14.3, npm@^6.10.3: libnpx "^10.2.2" lock-verify "^2.1.0" lockfile "^1.0.4" + lodash._baseindexof "*" lodash._baseuniq "~4.6.0" + lodash._bindcallback "*" + lodash._cacheindexof "*" + lodash._createcache "*" + lodash._getnative "*" lodash.clonedeep "~4.5.0" + lodash.restparam "*" lodash.union "~4.6.0" lodash.uniq "~4.5.0" lodash.without "~4.4.0"