From 7a939a897097a730f1579002ed641a583d3381c4 Mon Sep 17 00:00:00 2001 From: Pierre Vanduynslager Date: Fri, 1 Nov 2019 20:38:45 -0400 Subject: [PATCH 1/8] fix: use authenticated URL to check if local branch is up to date --- index.js | 2 +- lib/git.js | 5 +++-- test/git.test.js | 8 ++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index 66fc877c..2014a81b 100644 --- a/index.js +++ b/index.js @@ -65,7 +65,7 @@ async function run(context, plugins) { try { await verifyAuth(options.repositoryUrl, options.branch, {cwd, env}); } catch (error) { - if (!(await isBranchUpToDate(options.branch, {cwd, env}))) { + if (!(await isBranchUpToDate(options.repositoryUrl, options.branch, {cwd, env}))) { logger.log( `The local branch ${options.branch} is behind the remote one, therefore a new version won't be published.` ); diff --git a/lib/git.js b/lib/git.js index 88ef0e41..a190f710 100644 --- a/lib/git.js +++ b/lib/git.js @@ -170,13 +170,14 @@ async function verifyTagName(tagName, execaOpts) { /** * Verify the local branch is up to date with the remote one. * + * @param {String} repositoryUrl The remote repository URL. * @param {String} branch The repository branch for which to verify status. * @param {Object} [execaOpts] Options to pass to `execa`. * * @return {Boolean} `true` is the HEAD of the current local branch is the same as the HEAD of the remote branch, falsy otherwise. */ -async function isBranchUpToDate(branch, execaOpts) { - const {stdout: remoteHead} = await execa('git', ['ls-remote', '--heads', 'origin', branch], execaOpts); +async function isBranchUpToDate(repositoryUrl, branch, execaOpts) { + const {stdout: remoteHead} = await execa('git', ['ls-remote', '--heads', repositoryUrl, branch], execaOpts); try { return await isRefInHistory(remoteHead.match(/^(\w+)?/)[1], execaOpts); } catch (error) { diff --git a/test/git.test.js b/test/git.test.js index 3ae326a3..1d79dfb4 100644 --- a/test/git.test.js +++ b/test/git.test.js @@ -214,7 +214,7 @@ test('Return "true" if repository is up to date', async t => { await gitCommits(['First'], {cwd}); await gitPush(repositoryUrl, 'master', {cwd}); - t.true(await isBranchUpToDate('master', {cwd})); + t.true(await isBranchUpToDate(repositoryUrl, 'master', {cwd})); }); test('Return falsy if repository is not up to date', async t => { @@ -223,13 +223,13 @@ test('Return falsy if repository is not up to date', async t => { await gitCommits(['Second'], {cwd}); await gitPush(repositoryUrl, 'master', {cwd}); - t.true(await isBranchUpToDate('master', {cwd})); + t.true(await isBranchUpToDate(repositoryUrl, 'master', {cwd})); const tmpRepo = await gitShallowClone(repositoryUrl); await gitCommits(['Third'], {cwd: tmpRepo}); await gitPush('origin', 'master', {cwd: tmpRepo}); - t.falsy(await isBranchUpToDate('master', {cwd})); + t.falsy(await isBranchUpToDate(repositoryUrl, 'master', {cwd})); }); test('Return "true" if local repository is ahead', async t => { @@ -238,5 +238,5 @@ test('Return "true" if local repository is ahead', async t => { await gitPush(repositoryUrl, 'master', {cwd}); await gitCommits(['Second'], {cwd}); - t.true(await isBranchUpToDate('master', {cwd})); + t.true(await isBranchUpToDate(repositoryUrl, 'master', {cwd})); }); From ffff100f472c3427ae157fe2edc8c6871bf542e2 Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" <23040076+greenkeeper[bot]@users.noreply.github.com> Date: Sat, 2 Nov 2019 16:05:42 +0000 Subject: [PATCH 2/8] fix(package): update cosmiconfig to version 6.0.0 --- lib/get-config.js | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/get-config.js b/lib/get-config.js index 3423ad6c..71d93593 100644 --- a/lib/get-config.js +++ b/lib/get-config.js @@ -1,6 +1,6 @@ const {castArray, pickBy, isNil, isString, isPlainObject} = require('lodash'); const readPkgUp = require('read-pkg-up'); -const cosmiconfig = require('cosmiconfig'); +const {cosmiconfig} = require('cosmiconfig'); const resolveFrom = require('resolve-from'); const debug = require('debug')('semantic-release:config'); const {repoUrl} = require('./git'); diff --git a/package.json b/package.json index a90405ed..09d7d307 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "@semantic-release/npm": "^5.0.5", "@semantic-release/release-notes-generator": "^7.1.2", "aggregate-error": "^3.0.0", - "cosmiconfig": "^5.0.1", + "cosmiconfig": "^6.0.0", "debug": "^4.0.0", "env-ci": "^4.0.0", "execa": "^3.2.0", From 2c13136ff48d4700cc0592f0a955e570bb17061e Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" <23040076+greenkeeper[bot]@users.noreply.github.com> Date: Sat, 16 Nov 2019 22:55:25 +0000 Subject: [PATCH 3/8] fix(package): update yargs to version 15.0.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 09d7d307..aebb1816 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "resolve-from": "^5.0.0", "semver": "^6.0.0", "signale": "^1.2.1", - "yargs": "^14.0.0" + "yargs": "^15.0.1" }, "devDependencies": { "ava": "^2.0.0", From 09754ac00134ea7613ec5ec6fa3781392c8f64a0 Mon Sep 17 00:00:00 2001 From: Ed Date: Sat, 5 Oct 2019 21:27:53 +0200 Subject: [PATCH 4/8] docs(shareable-configurations-list): add semantic-release-npm-github-publish --- docs/extending/shareable-configurations-list.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/extending/shareable-configurations-list.md b/docs/extending/shareable-configurations-list.md index 8396910a..f439b271 100644 --- a/docs/extending/shareable-configurations-list.md +++ b/docs/extending/shareable-configurations-list.md @@ -11,3 +11,11 @@ - Publishes the same tarball to [npm](https://github.com/semantic-release/npm). - Commits the version change in `package.json`. - Creates or updates a [changelog](https://github.com/semantic-release/changelog) file. +- [semantic-release-npm-github-publish](https://github.com/oleg-koval/semantic-release-npm-github-publish) + - Based on [angular preset](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular). + - Adds more keywords for the `chore` **PATCH** release. + - Generates or updates a [changelog](https://github.com/semantic-release/changelog) file including all **PATCH** keywords (not included in default angular package). + - Updates GitHub release with release-notes. + - Bumps a version in package.json. + - Publishes the new version to [NPM](https://npmjs.org). + From 9575198266562f42221917116876aa016f2c2a84 Mon Sep 17 00:00:00 2001 From: Sean Dawson Date: Mon, 18 Nov 2019 17:29:10 +0100 Subject: [PATCH 5/8] docs: add leiningen-semantic-release to list of community plugins --- docs/extending/plugins-list.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/extending/plugins-list.md b/docs/extending/plugins-list.md index f81efd4c..e2694ba8 100644 --- a/docs/extending/plugins-list.md +++ b/docs/extending/plugins-list.md @@ -91,3 +91,7 @@ - [semantic-release-github-pages](https://github.com/qiwi/semantic-release-gh-pages-plugin) - `verifyConditions`: Verify the presence of the auth token set via environment variables. - `publish`: Pushes commit to the documentation branch. +- [leiningen-semantic-release](https://github.com/NoxHarmonium/leiningen-semantic-release) + - `verifyConditions`: Checks the project.clj is syntactically valid. + - `prepare`: Update the project.clj version and package the output jar file. + - `publish`: Publish the jar (and generated Maven metadata) to a maven repository (or clojars). From b2b7b57fbd51af3fe25accdd6cd8499beb9005e5 Mon Sep 17 00:00:00 2001 From: Pierre Vanduynslager Date: Wed, 20 Nov 2019 20:17:46 -0500 Subject: [PATCH 6/8] style: prettier formatting --- lib/get-commits.js | 8 +++++--- test/helpers/git-utils.js | 8 +++++--- test/plugins/pipeline.test.js | 21 ++++++++++++++++++--- 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/lib/get-commits.js b/lib/get-commits.js index 69d20dfb..691d3113 100644 --- a/lib/get-commits.js +++ b/lib/get-commits.js @@ -17,9 +17,11 @@ module.exports = async ({cwd, env, lastRelease: {gitHead}, logger}) => { } Object.assign(gitLogParser.fields, {hash: 'H', message: 'B', gitTags: 'd', committerDate: {key: 'ci', type: Date}}); - const commits = (await getStream.array( - gitLogParser.parse({_: `${gitHead ? gitHead + '..' : ''}HEAD`}, {cwd, env: {...process.env, ...env}}) - )).map(commit => { + const commits = ( + await getStream.array( + gitLogParser.parse({_: `${gitHead ? gitHead + '..' : ''}HEAD`}, {cwd, env: {...process.env, ...env}}) + ) + ).map(commit => { commit.message = commit.message.trim(); commit.gitTags = commit.gitTags.trim(); return commit; diff --git a/test/helpers/git-utils.js b/test/helpers/git-utils.js index 9dd4b897..e2c3d452 100644 --- a/test/helpers/git-utils.js +++ b/test/helpers/git-utils.js @@ -87,9 +87,11 @@ export async function gitCommits(messages, execaOpts) { */ export async function gitGetCommits(from, execaOpts) { Object.assign(gitLogParser.fields, {hash: 'H', message: 'B', gitTags: 'd', committerDate: {key: 'ci', type: Date}}); - return (await getStream.array( - gitLogParser.parse({_: `${from ? from + '..' : ''}HEAD`}, {...execaOpts, env: {...process.env, ...execaOpts.env}}) - )).map(commit => { + return ( + await getStream.array( + gitLogParser.parse({_: `${from ? from + '..' : ''}HEAD`}, {...execaOpts, env: {...process.env, ...execaOpts.env}}) + ) + ).map(commit => { commit.message = commit.message.trim(); commit.gitTags = commit.gitTags.trim(); return commit; diff --git a/test/plugins/pipeline.test.js b/test/plugins/pipeline.test.js index 6c58129e..d3f6e434 100644 --- a/test/plugins/pipeline.test.js +++ b/test/plugins/pipeline.test.js @@ -47,7 +47,12 @@ test('Execute each function in series passing the "lastResult" and "result" to " const result = await pipeline([step1, step2, step3, step4], {settleAll: false, getNextInput})(5); t.deepEqual(result, [1, 2, 3, 4]); - t.deepEqual(getNextInput.args, [[5, 1], [5, 2], [5, 3], [5, 4]]); + t.deepEqual(getNextInput.args, [ + [5, 1], + [5, 2], + [5, 3], + [5, 4], + ]); }); test('Execute each function in series calling "transform" to modify the results', async t => { @@ -61,7 +66,12 @@ test('Execute each function in series calling "transform" to modify the results' const result = await pipeline([step1, step2, step3, step4], {getNextInput, transform})(5); t.deepEqual(result, [1 + 1, 2 + 1, 3 + 1, 4 + 1]); - t.deepEqual(getNextInput.args, [[5, 1 + 1], [5, 2 + 1], [5, 3 + 1], [5, 4 + 1]]); + t.deepEqual(getNextInput.args, [ + [5, 1 + 1], + [5, 2 + 1], + [5, 3 + 1], + [5, 4 + 1], + ]); }); test('Execute each function in series calling "transform" to modify the results with "settleAll"', async t => { @@ -75,7 +85,12 @@ test('Execute each function in series calling "transform" to modify the results const result = await pipeline([step1, step2, step3, step4], {settleAll: true, getNextInput, transform})(5); t.deepEqual(result, [1 + 1, 2 + 1, 3 + 1, 4 + 1]); - t.deepEqual(getNextInput.args, [[5, 1 + 1], [5, 2 + 1], [5, 3 + 1], [5, 4 + 1]]); + t.deepEqual(getNextInput.args, [ + [5, 1 + 1], + [5, 2 + 1], + [5, 3 + 1], + [5, 4 + 1], + ]); }); test('Stop execution and throw error if a step rejects', async t => { From 29d6b5d6fa528ed1c1aa6ddc92081f2d2e680ad7 Mon Sep 17 00:00:00 2001 From: Gregor Martynus Date: Thu, 28 Nov 2019 12:16:23 -0800 Subject: [PATCH 7/8] build: remove `.github/airtable-crm.yml` I don't think we use that --- .github/airtable-crm.yml | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .github/airtable-crm.yml diff --git a/.github/airtable-crm.yml b/.github/airtable-crm.yml deleted file mode 100644 index f196f036..00000000 --- a/.github/airtable-crm.yml +++ /dev/null @@ -1 +0,0 @@ -base: app0ZOxG0FnHmOiuU From ecc4e663f55dfbaac9f217538fce6df97b064dd3 Mon Sep 17 00:00:00 2001 From: Pierre Vanduynslager Date: Tue, 3 Dec 2019 11:09:32 -0500 Subject: [PATCH 8/8] docs: clarify GitLab CI/CD protected variable usage --- docs/recipes/gitlab-ci.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/recipes/gitlab-ci.md b/docs/recipes/gitlab-ci.md index 024e50c1..5df4b1b4 100644 --- a/docs/recipes/gitlab-ci.md +++ b/docs/recipes/gitlab-ci.md @@ -2,7 +2,9 @@ ## Environment variables -The [Authentication](../usage/ci-configuration.md#authentication) environment variables can be configured with [Secret variables](https://docs.gitlab.com/ce/ci/variables/README.html#secret-variables). +The [Authentication](../usage/ci-configuration.md#authentication) environment variables can be configured with [Protected variables](https://docs.gitlab.com/ce/ci/variables/README.html#protected-environment-variables). + +**Note**: Make sure to configure your release branch as [protected](https://docs.gitlab.com/ce/user/project/protected_branches.html) in order for the CI/CD build to access the protected variables. ## Node project configuration