Skip to content
Snippets Groups Projects
Unverified Commit dde29882 authored by Michael Kriese's avatar Michael Kriese Committed by GitHub
Browse files

chore(ci): ignore duplicate publish error (#5815)

* chore(ci): ignore duplicate publish error

* add deps
parent f5c5a575
No related branches found
No related tags found
No related merge requests found
...@@ -173,6 +173,8 @@ ...@@ -173,6 +173,8 @@
"re2": "1.10.5" "re2": "1.10.5"
}, },
"devDependencies": { "devDependencies": {
"@actions/core": "1.2.3",
"@actions/exec": "1.0.3",
"@babel/cli": "7.8.4", "@babel/cli": "7.8.4",
"@babel/core": "7.9.0", "@babel/core": "7.9.0",
"@babel/node": "7.8.7", "@babel/node": "7.8.7",
......
import got from 'got'; import got from 'got';
import shell from 'shelljs'; import core from '@actions/core';
import { program } from './utils.mjs'; import { program } from './utils.mjs';
const version = program.release; const version = program.release;
...@@ -7,32 +7,34 @@ const dry = program.dryRun; ...@@ -7,32 +7,34 @@ const dry = program.dryRun;
const baseUrl = 'https://api.github.com/'; const baseUrl = 'https://api.github.com/';
shell.echo(`Dispatching version: ${version}`); export default async function run() {
core.info(`Dispatching version: ${version}`);
(async () => {
if (dry) { if (dry) {
shell.echo('DRY-RUN: done.'); core.warning('DRY-RUN: done.');
return; return;
} }
await got(`repos/${process.env.GITHUB_REPOSITORY}/dispatches`, { try {
baseUrl, await got(`repos/${process.env.GITHUB_REPOSITORY}/dispatches`, {
headers: { baseUrl,
'user-agent': 'Renovate release helper', headers: {
authorization: `token ${process.env.GITHUB_TOKEN}`, '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,
})().catch(e => { body: {
// Ignore for now event_type: 'renovate-release',
shell.echo(e.toString()); // 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());
}
}
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
"private": true, "private": true,
"type": "module", "type": "module",
"dependencies": { "dependencies": {
"@actions/core": "1.2.3",
"@actions/exec": "1.0.3",
"commander": "4.1.1", "commander": "4.1.1",
"fs-extra": "8.1.0", "fs-extra": "8.1.0",
"got": "9.6.0", "got": "9.6.0",
......
import shell from 'shelljs'; import core from '@actions/core';
import { program, exec } from './utils.mjs'; import { program, exec } from './utils.mjs';
import dispatch from './dispatch-release.mjs';
const version = program.release; const version = program.release;
const sha = program.sha; const sha = program.sha;
let err = false; let err = false;
shell.echo(`Publishing version: ${version}`); core.info(`Publishing version: ${version}`);
shell.echo('Publishing npm package ...'); core.info('Publishing npm package ...');
if ( if (
!exec(`npm --no-git-tag-version version ${version}`) || !exec(`npm --no-git-tag-version version ${version}`) ||
!exec(`npm publish`) !exec(`npm publish`, [
'You cannot publish over the previously published versions',
])
) { ) {
err = true; err = true;
} }
shell.echo('Publishing docker images ...'); core.info('Publishing docker images ...');
if (!exec(`./.github/workflows/release-docker.sh ${version} ${sha}`)) { if (!exec(`./.github/workflows/release-docker.sh ${version} ${sha}`)) {
err = true; err = true;
} }
// eslint-disable-next-line promise/valid-params dispatch();
import('./dispatch-release.mjs').catch();
if (err) { if (err) {
shell.exit(2); core.setFailed('release failed partially');
} }
import commander from 'commander'; import commander from 'commander';
import core from '@actions/core';
import shell from 'shelljs'; import shell from 'shelljs';
const program = new commander.Command(); const program = new commander.Command();
...@@ -17,16 +18,33 @@ export { program }; ...@@ -17,16 +18,33 @@ export { program };
* @param cmd {string} The command to execute * @param cmd {string} The command to execute
* @returns {boolean} Returns true on zero exit code otherwise false * @returns {boolean} Returns true on zero exit code otherwise false
*/ */
export function exec(cmd) { export function exec(cmd, ignores = []) {
try { try {
if (!program.dryRun) { if (program.dryRun) {
const res = shell.exec(cmd); core.warning(`DRY-RUN: ${cmd}`);
return res.code === 0; return true;
} }
shell.echo(`DRY-RUN: ${cmd}`);
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;
} catch (e) { } catch (e) {
shell.echo(e.toString()); core.error(e.toString());
return false; return false;
} finally {
core.endGroup(cmd);
} }
return true;
} }
import shell from 'shelljs'; import core from '@actions/core';
import exec from '@actions/exec';
shell.echo(`Verifying ...`); core.info(`Verifying ...`);
(async () => {
const res = shell.exec(`npm whoami`); try {
if (res.code !== 0) { core.groupStart('npm whoami');
shell.exit(2); await exec.exec(`npm`, ['whoami']);
} } catch (e) {
core.setFailed('npm auth error');
} finally {
core.endGroup('npm whoami');
}
})();
...@@ -2,6 +2,23 @@ ...@@ -2,6 +2,23 @@
# yarn lockfile v1 # 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": "@babel/cli@7.8.4":
version "7.8.4" version "7.8.4"
resolved "https://registry.yarnpkg.com/@babel/cli/-/cli-7.8.4.tgz#505fb053721a98777b2b175323ea4f090b7d3c1c" resolved "https://registry.yarnpkg.com/@babel/cli/-/cli-7.8.4.tgz#505fb053721a98777b2b175323ea4f090b7d3c1c"
...@@ -3078,7 +3095,7 @@ debug@^3.1.0, debug@^3.2.6: ...@@ -3078,7 +3095,7 @@ debug@^3.1.0, debug@^3.2.6:
dependencies: dependencies:
ms "^2.1.1" ms "^2.1.1"
debuglog@*, debuglog@^1.0.1: debuglog@^1.0.1:
version "1.0.1" version "1.0.1"
resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492" resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492"
integrity sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI= integrity sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI=
...@@ -4658,7 +4675,7 @@ import-local@^3.0.2: ...@@ -4658,7 +4675,7 @@ import-local@^3.0.2:
pkg-dir "^4.2.0" pkg-dir "^4.2.0"
resolve-cwd "^3.0.0" resolve-cwd "^3.0.0"
imurmurhash@*, imurmurhash@^0.1.4: imurmurhash@^0.1.4:
version "0.1.4" version "0.1.4"
resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"
integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= integrity sha1-khi5srkoojixPcT7a21XbyMUU+o=
...@@ -5962,11 +5979,6 @@ lockfile@^1.0.4: ...@@ -5962,11 +5979,6 @@ lockfile@^1.0.4:
dependencies: dependencies:
signal-exit "^3.0.2" 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: lodash._baseuniq@~4.6.0:
version "4.6.0" version "4.6.0"
resolved "https://registry.yarnpkg.com/lodash._baseuniq/-/lodash._baseuniq-4.6.0.tgz#0ebb44e456814af7905c6212fa2c9b2d51b841e8" resolved "https://registry.yarnpkg.com/lodash._baseuniq/-/lodash._baseuniq-4.6.0.tgz#0ebb44e456814af7905c6212fa2c9b2d51b841e8"
...@@ -5975,33 +5987,11 @@ lodash._baseuniq@~4.6.0: ...@@ -5975,33 +5987,11 @@ lodash._baseuniq@~4.6.0:
lodash._createset "~4.0.0" lodash._createset "~4.0.0"
lodash._root "~3.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: lodash._createset@~4.0.0:
version "4.0.3" version "4.0.3"
resolved "https://registry.yarnpkg.com/lodash._createset/-/lodash._createset-4.0.3.tgz#0f4659fbb09d75194fa9e2b88a6644d363c9fe26" resolved "https://registry.yarnpkg.com/lodash._createset/-/lodash._createset-4.0.3.tgz#0f4659fbb09d75194fa9e2b88a6644d363c9fe26"
integrity sha1-D0ZZ+7CddRlPqeK4imZE02PJ/iY= 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: lodash._reinterpolate@^3.0.0:
version "3.0.0" version "3.0.0"
resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d" resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d"
...@@ -6047,11 +6037,6 @@ lodash.isstring@^4.0.1: ...@@ -6047,11 +6037,6 @@ lodash.isstring@^4.0.1:
resolved "https://registry.yarnpkg.com/lodash.isstring/-/lodash.isstring-4.0.1.tgz#d527dfb5456eca7cc9bb95d5daeaf88ba54a5451" resolved "https://registry.yarnpkg.com/lodash.isstring/-/lodash.isstring-4.0.1.tgz#d527dfb5456eca7cc9bb95d5daeaf88ba54a5451"
integrity sha1-1SfftUVuynzJu5XV2ur4i6VKVFE= 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: lodash.sortby@^4.7.0:
version "4.7.0" version "4.7.0"
resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438"
...@@ -6977,7 +6962,6 @@ npm@6.14.3, npm@^6.10.3: ...@@ -6977,7 +6962,6 @@ npm@6.14.3, npm@^6.10.3:
cmd-shim "^3.0.3" cmd-shim "^3.0.3"
columnify "~1.5.4" columnify "~1.5.4"
config-chain "^1.1.12" config-chain "^1.1.12"
debuglog "*"
detect-indent "~5.0.0" detect-indent "~5.0.0"
detect-newline "^2.1.0" detect-newline "^2.1.0"
dezalgo "~1.0.3" dezalgo "~1.0.3"
...@@ -6992,7 +6976,6 @@ npm@6.14.3, npm@^6.10.3: ...@@ -6992,7 +6976,6 @@ npm@6.14.3, npm@^6.10.3:
has-unicode "~2.0.1" has-unicode "~2.0.1"
hosted-git-info "^2.8.8" hosted-git-info "^2.8.8"
iferr "^1.0.2" iferr "^1.0.2"
imurmurhash "*"
infer-owner "^1.0.4" infer-owner "^1.0.4"
inflight "~1.0.6" inflight "~1.0.6"
inherits "^2.0.4" inherits "^2.0.4"
...@@ -7011,14 +6994,8 @@ npm@6.14.3, npm@^6.10.3: ...@@ -7011,14 +6994,8 @@ npm@6.14.3, npm@^6.10.3:
libnpx "^10.2.2" libnpx "^10.2.2"
lock-verify "^2.1.0" lock-verify "^2.1.0"
lockfile "^1.0.4" lockfile "^1.0.4"
lodash._baseindexof "*"
lodash._baseuniq "~4.6.0" lodash._baseuniq "~4.6.0"
lodash._bindcallback "*"
lodash._cacheindexof "*"
lodash._createcache "*"
lodash._getnative "*"
lodash.clonedeep "~4.5.0" lodash.clonedeep "~4.5.0"
lodash.restparam "*"
lodash.union "~4.6.0" lodash.union "~4.6.0"
lodash.uniq "~4.5.0" lodash.uniq "~4.5.0"
lodash.without "~4.4.0" lodash.without "~4.4.0"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment