From b22a7f3e8fd5bd2a226c5e34105d90026916f0e4 Mon Sep 17 00:00:00 2001 From: Nathan Friend Date: Wed, 9 Dec 2020 12:00:33 -0500 Subject: [PATCH] fix: update release URL returned from publish.js (#185) --- lib/publish.js | 2 +- test/integration.test.js | 4 ++-- test/publish.test.js | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/publish.js b/lib/publish.js index 97c0c5ec..e6f6d289 100644 --- a/lib/publish.js +++ b/lib/publish.js @@ -88,5 +88,5 @@ module.exports = async (pluginConfig, context) => { logger.log('Published GitLab release: %s', gitTag); - return {url: urlJoin(gitlabUrl, encodedRepoId, `/tags/${encodedGitTag}`), name: 'GitLab release'}; + return {url: urlJoin(gitlabUrl, encodedRepoId, `/-/releases/${encodedGitTag}`), name: 'GitLab release'}; }; diff --git a/test/integration.test.js b/test/integration.test.js index 88847139..4a76dcdc 100644 --- a/test/integration.test.js +++ b/test/integration.test.js @@ -76,7 +76,7 @@ test.serial('Publish a release', async t => { const result = await t.context.m.publish({}, {env, nextRelease, options, logger: t.context.logger}); - t.is(result.url, `https://gitlab.com/${encodedRepoId}/tags/${nextRelease.gitTag}`); + t.is(result.url, `https://gitlab.com/${encodedRepoId}/-/releases/${nextRelease.gitTag}`); t.deepEqual(t.context.log.args[0], ['Verify GitLab authentication (%s)', 'https://gitlab.com/api/v4']); t.deepEqual(t.context.log.args[1], ['Published GitLab release: %s', nextRelease.gitTag]); t.true(gitlab.isDone()); @@ -105,7 +105,7 @@ test.serial('Verify Github auth and release', async t => { await t.notThrowsAsync(t.context.m.verifyConditions({}, {env, options, logger: t.context.logger})); const result = await t.context.m.publish({}, {env, options, nextRelease, logger: t.context.logger}); - t.is(result.url, `https://gitlab.com/${encodedRepoId}/tags/${nextRelease.gitTag}`); + t.is(result.url, `https://gitlab.com/${encodedRepoId}/-/releases/${nextRelease.gitTag}`); t.deepEqual(t.context.log.args[0], ['Verify GitLab authentication (%s)', 'https://gitlab.com/api/v4']); t.deepEqual(t.context.log.args[1], ['Published GitLab release: %s', nextRelease.gitTag]); t.true(gitlab.isDone()); diff --git a/test/publish.test.js b/test/publish.test.js index f24c01f3..9a59966d 100644 --- a/test/publish.test.js +++ b/test/publish.test.js @@ -40,7 +40,7 @@ test.serial('Publish a release', async t => { const result = await publish(pluginConfig, {env, options, nextRelease, logger: t.context.logger}); - t.is(result.url, `https://gitlab.com/${encodedRepoId}/tags/${encodedGitTag}`); + t.is(result.url, `https://gitlab.com/${encodedRepoId}/-/releases/${encodedGitTag}`); t.deepEqual(t.context.log.args[0], ['Published GitLab release: %s', nextRelease.gitTag]); t.true(gitlab.isDone()); }); @@ -76,7 +76,7 @@ test.serial('Publish a release with assets', async t => { const result = await publish({assets}, {env, cwd, options, nextRelease, logger: t.context.logger}); - t.is(result.url, `https://gitlab.com/${encodedRepoId}/tags/${encodedGitTag}`); + t.is(result.url, `https://gitlab.com/${encodedRepoId}/-/releases/${encodedGitTag}`); t.deepEqual(t.context.log.args[0], ['Uploaded file: %s', uploaded.url]); t.deepEqual(t.context.log.args[1], ['Published GitLab release: %s', nextRelease.gitTag]); t.true(gitlabUpload.isDone()); @@ -105,7 +105,7 @@ test.serial('Publish a release with array of missing assets', async t => { .reply(200); const result = await publish({assets}, {env, cwd, options, nextRelease, logger: t.context.logger}); - t.is(result.url, `https://gitlab.com/${encodedRepoId}/tags/${encodedGitTag}`); + t.is(result.url, `https://gitlab.com/${encodedRepoId}/-/releases/${encodedGitTag}`); t.deepEqual(t.context.log.args[0], ['Published GitLab release: %s', nextRelease.gitTag]); t.true(gitlab.isDone()); }); @@ -142,7 +142,7 @@ test.serial('Publish a release with one asset and custom label', async t => { const result = await publish({assets}, {env, cwd, options, nextRelease, logger: t.context.logger}); - t.is(result.url, `https://gitlab.com/${encodedRepoId}/tags/${encodedGitTag}`); + t.is(result.url, `https://gitlab.com/${encodedRepoId}/-/releases/${encodedGitTag}`); t.deepEqual(t.context.log.args[0], ['Uploaded file: %s', uploaded.url]); t.deepEqual(t.context.log.args[1], ['Published GitLab release: %s', nextRelease.gitTag]); t.true(gitlabUpload.isDone()); @@ -170,7 +170,7 @@ test.serial('Publish a release with missing release notes', async t => { const result = await publish(pluginConfig, {env, options, nextRelease, logger: t.context.logger}); - t.is(result.url, `https://gitlab.com/${encodedRepoId}/tags/${encodedGitTag}`); + t.is(result.url, `https://gitlab.com/${encodedRepoId}/-/releases/${encodedGitTag}`); t.deepEqual(t.context.log.args[0], ['Published GitLab release: %s', nextRelease.gitTag]); t.true(gitlab.isDone()); });