@cmflow/cli 1.1.0 → 1.1.1-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/.prettierignore +5 -0
  2. package/.prettierrc +10 -0
  3. package/README.md +106 -32
  4. package/bin/cm-changelog.js +20 -12
  5. package/bin/cm-clean.js +4 -7
  6. package/bin/cm-config.js +8 -8
  7. package/bin/cm-deploy.js +4 -8
  8. package/bin/cm-fetch.js +7 -7
  9. package/bin/cm-finish.js +9 -9
  10. package/bin/cm-merge.js +7 -7
  11. package/bin/cm-publish.js +10 -10
  12. package/bin/cm-push.js +10 -10
  13. package/bin/cm-rebase.js +10 -10
  14. package/bin/cm-republish.js +7 -7
  15. package/bin/cm-start.js +10 -10
  16. package/bin/cm.js +20 -20
  17. package/bin/cmrelease.js +2 -2
  18. package/eslint.config.mjs +67 -0
  19. package/package.json +27 -21
  20. package/release.config.mjs +49 -19
  21. package/src/commands/changelog.js +23 -23
  22. package/src/commands/clean.js +13 -13
  23. package/src/commands/config.js +8 -8
  24. package/src/commands/deploy.js +15 -20
  25. package/src/commands/fetch.js +7 -10
  26. package/src/commands/finish.js +18 -19
  27. package/src/commands/index.js +10 -11
  28. package/src/commands/merge.js +30 -14
  29. package/src/commands/prompts/branches.js +20 -20
  30. package/src/commands/push.js +11 -14
  31. package/src/commands/rebase.js +17 -19
  32. package/src/commands/release.js +10 -11
  33. package/src/commands/republish.js +11 -14
  34. package/src/commands/start.js +52 -48
  35. package/src/commands/tasks/merge-branch.js +41 -37
  36. package/src/commands/tasks/push-branch.js +5 -11
  37. package/src/commands/tasks/rebase-all-branches.js +19 -24
  38. package/src/commands/tasks/refresh-repository.js +26 -24
  39. package/src/commands/tasks/run-test.js +11 -17
  40. package/src/commands/tasks/update-branch.js +33 -30
  41. package/src/commands/tasks/update-dependencies.js +38 -32
  42. package/src/commands/utils/check-install.js +16 -15
  43. package/src/common/cli/cli.js +55 -57
  44. package/src/common/cli/docker.js +31 -28
  45. package/src/common/cli/docker.test.js +94 -96
  46. package/src/common/cli/git.js +59 -68
  47. package/src/common/cli/git.test.js +187 -189
  48. package/src/common/cli/lerna.js +12 -12
  49. package/src/common/cli/lerna.test.js +38 -40
  50. package/src/common/cli/npm.js +17 -17
  51. package/src/common/cli/npm.test.js +38 -40
  52. package/src/common/cli/yarn.js +17 -17
  53. package/src/common/cli/yarn.test.js +40 -40
  54. package/src/common/configure-git-workspace.js +11 -17
  55. package/src/common/get-config.js +63 -119
  56. package/src/common/get-package-json.js +4 -4
  57. package/src/common/get-release-config.js +4 -5
  58. package/src/common/index.js +10 -10
  59. package/src/common/run-command.js +26 -28
  60. package/src/common/run-command.test.js +35 -39
  61. package/src/index.js +10 -1
  62. package/src/semantic/core/analyze-commits.js +17 -0
  63. package/src/semantic/core/fail.js +29 -0
  64. package/src/semantic/core/generate-notes.js +11 -0
  65. package/src/semantic/core/prepare/bump-version.js +38 -0
  66. package/src/semantic/core/prepare/post.js +38 -0
  67. package/src/semantic/core/prepare/run.js +22 -0
  68. package/src/semantic/core/publish.js +9 -0
  69. package/src/semantic/core/success.js +37 -0
  70. package/src/semantic/core/verify-conditions.js +32 -0
  71. package/src/semantic/core/verify-release.js +9 -0
  72. package/src/semantic/define-config.js +68 -0
  73. package/src/semantic/docker/publish.js +5 -0
  74. package/src/semantic/docker/success.js +9 -0
  75. package/src/semantic/utils/bump-packages-version.js +52 -0
  76. package/src/semantic/utils/bump-packages-version.test.js +75 -0
  77. package/src/semantic/utils/calculate-snapshot-version.js +15 -0
  78. package/src/semantic/utils/calculate-snapshot-version.test.js +67 -0
  79. package/src/semantic/utils/display-package-info.js +11 -0
  80. package/src/semantic/utils/display-release-info.js +12 -0
  81. package/src/semantic/utils/docker-clean-tags.js +51 -0
  82. package/src/semantic/utils/docker-clean-tags.test.js +61 -0
  83. package/src/semantic/utils/docker-publish.js +23 -0
  84. package/src/semantic/utils/docker-publish.test.js +44 -0
  85. package/src/semantic/utils/log-section.js +5 -0
  86. package/src/semantic/utils/release-rules.js +5 -0
  87. package/src/semantic/utils/transform-writer.js +75 -0
  88. package/src/workflow/index.js +22 -22
  89. package/tsconfig.json +54 -0
  90. package/vitest.config.mts +10 -0
  91. package/bin/cm-publish-pages.js +0 -12
  92. package/semantic.js +0 -1
  93. package/src/commands/publish-pages.js +0 -29
  94. package/src/common/cli/heroku.js +0 -21
  95. package/src/common/cli/heroku.test.js +0 -62
  96. package/src/main.js +0 -10
  97. package/src/semantic-release/actions/analyze-commits.js +0 -14
  98. package/src/semantic-release/actions/fail.js +0 -16
  99. package/src/semantic-release/actions/generate-notes.js +0 -12
  100. package/src/semantic-release/actions/index.js +0 -8
  101. package/src/semantic-release/actions/prepare.js +0 -114
  102. package/src/semantic-release/actions/publish.js +0 -17
  103. package/src/semantic-release/actions/success.js +0 -32
  104. package/src/semantic-release/actions/verify-conditions.js +0 -30
  105. package/src/semantic-release/actions/verify-release.js +0 -9
  106. package/src/semantic-release/get-semantic-config.js +0 -115
  107. package/src/semantic-release/utils/bump-packages-version.js +0 -51
  108. package/src/semantic-release/utils/bump-packages-version.test.js +0 -78
  109. package/src/semantic-release/utils/calculate-snapshot-version.js +0 -10
  110. package/src/semantic-release/utils/calculate-snapshot-version.test.js +0 -69
  111. package/src/semantic-release/utils/display-package-info.js +0 -11
  112. package/src/semantic-release/utils/display-release-info.js +0 -12
  113. package/src/semantic-release/utils/docker-clean-tags.js +0 -45
  114. package/src/semantic-release/utils/docker-clean-tags.test.js +0 -63
  115. package/src/semantic-release/utils/docker-publish.js +0 -47
  116. package/src/semantic-release/utils/docker-publish.test.js +0 -67
  117. package/src/semantic-release/utils/ghpages-publish.js +0 -16
  118. package/src/semantic-release/utils/log-section.js +0 -5
  119. /package/src/{semantic-release → semantic}/utils/__mock__/test1/package.json +0 -0
  120. /package/src/{semantic-release → semantic}/utils/__mock__/test1/packages/a/package.json +0 -0
  121. /package/src/{semantic-release → semantic}/utils/__mock__/test1/packages/b/package.json +0 -0
  122. /package/src/{semantic-release → semantic}/utils/__mock__/test2/package.json +0 -0
  123. /package/src/{semantic-release → semantic}/utils/__mock__/test2/packages/a/package.json +0 -0
  124. /package/src/{semantic-release → semantic}/utils/__mock__/test2/packages/b/package.json +0 -0
@@ -1,51 +0,0 @@
1
- import globby from 'globby'
2
- import fs from 'fs-extra'
3
- import { dirname } from 'path'
4
-
5
- const PACKAGE_JSON_PROPS = ['dependencies', 'devDependencies', 'peerDependencies']
6
-
7
- export async function bumpPackagesVersion (version, workspaces, cwd = process.cwd()) {
8
- const patterns = workspaces.map((path) => `${path}/package.json`).concat('package.json')
9
-
10
- const files = await globby(patterns, {
11
- cwd,
12
- absolute: true
13
- })
14
-
15
- const names = new Set()
16
-
17
- const packages = await Promise.all(files.map(async (file) => {
18
- const pkg = await fs.readJson(file)
19
-
20
- names.add(pkg.name)
21
-
22
- return {
23
- file,
24
- pkg
25
- }
26
- }))
27
-
28
- return Promise.all(packages.map(({
29
- pkg,
30
- file
31
- }) => {
32
- pkg.version = version
33
-
34
- PACKAGE_JSON_PROPS.forEach((key) => bumpDependencies(pkg, key, version, names))
35
-
36
- fs.ensureDirSync(dirname(file))
37
- return fs.writeFile(file, JSON.stringify(pkg, null, 2), { encoding: 'utf8' })
38
- }))
39
- }
40
-
41
- function bumpDependencies (pkg, key, version, names) {
42
- pkg[key] = pkg[key] || {}
43
-
44
- if (pkg[key]) {
45
- names.forEach((name) => {
46
- if (pkg[key][name] && !pkg[key][name].startsWith('workspace:')) {
47
- pkg[key][name] = version
48
- }
49
- })
50
- }
51
- }
@@ -1,78 +0,0 @@
1
- import { bumpPackagesVersion } from './bump-packages-version.js'
2
- import path from 'path'
3
- import fs from 'fs-extra'
4
- import { jest, describe, it, beforeEach, expect } from '@jest/globals'
5
- import * as url from 'url'
6
- const __dirname = url.fileURLToPath(new URL('.', import.meta.url))
7
-
8
- describe('bumpPackagesVersion()', () => {
9
- beforeEach(() => {
10
- jest.resetAllMocks()
11
- jest.spyOn(fs, 'writeFile').mockResolvedValue()
12
- jest.spyOn(fs, 'ensureDirSync').mockResolvedValue()
13
- })
14
-
15
- it('should upgrade dependencies (package manager: npm/yarn)', async () => {
16
- await bumpPackagesVersion('1.1.0', [
17
- 'packages/*'
18
- ], path.join(__dirname, '__mock__/test1'))
19
-
20
- const calls = fs.writeFile.mock.calls.sort(([a], [b]) => a > b ? -1 : 1)
21
-
22
- expect(JSON.parse(calls[0][1])).toEqual({
23
- version: '1.1.0',
24
- name: '@package/b',
25
- dependencies: {},
26
- devDependencies: {},
27
- peerDependencies: {}
28
- })
29
-
30
- expect(JSON.parse(calls[1][1])).toEqual({
31
- name: '@package/a',
32
- version: '1.1.0',
33
- dependencies: { '@package/b': '1.1.0' },
34
- devDependencies: {},
35
- peerDependencies: {}
36
- })
37
-
38
- expect(JSON.parse(calls[2][1])).toEqual({
39
- name: '@package/root',
40
- version: '1.1.0',
41
- dependencies: {},
42
- devDependencies: {},
43
- peerDependencies: {}
44
- })
45
- })
46
- it('should upgrade dependencies (package manager: yarn berry)', async () => {
47
- await bumpPackagesVersion('1.1.0', [
48
- 'packages/*'
49
- ], path.join(__dirname, '__mock__/test2'))
50
- const calls = fs.writeFile.mock.calls.sort(([a], [b]) => a > b ? -1 : 1)
51
-
52
- expect(JSON.parse(calls[0][1])).toEqual({
53
- dependencies: {},
54
- devDependencies: {},
55
- name: '@package/b',
56
- peerDependencies: {},
57
- version: '1.1.0'
58
- })
59
-
60
- expect(JSON.parse(calls[1][1])).toEqual({
61
- dependencies: {
62
- '@package/b': 'workspace:*'
63
- },
64
- devDependencies: {},
65
- name: '@package/a',
66
- peerDependencies: {},
67
- version: '1.1.0'
68
- })
69
-
70
- expect(JSON.parse(calls[2][1])).toEqual({
71
- dependencies: {},
72
- devDependencies: {},
73
- name: '@package/root',
74
- peerDependencies: {},
75
- version: '1.1.0'
76
- })
77
- })
78
- })
@@ -1,10 +0,0 @@
1
- import semver from 'semver'
2
- import { getConfig, git } from '../../common/index.js'
3
-
4
- export function calculateSnapshotVersion (context) {
5
- context.config = getConfig()
6
- const { nextRelease: { type }, lastRelease, config: { REF_COMMIT } } = context
7
- const { major, minor, patch } = semver.parse(lastRelease.version)
8
-
9
- return `${semver.inc(`${major}.${minor}.${patch}`, type)}-beta${git.getCommitTag(REF_COMMIT)}`
10
- }
@@ -1,69 +0,0 @@
1
- import { beforeEach, describe, expect, it, jest } from '@jest/globals'
2
-
3
- jest.unstable_mockModule('../../common/index.js', () => {
4
- return {
5
- git: {
6
- getCommitTag: jest.fn()
7
- },
8
- getConfig: jest.fn()
9
- }
10
- })
11
- const { git, getConfig } = await import('../../common/index.js')
12
- const { calculateSnapshotVersion } = await import('./calculate-snapshot-version.js')
13
-
14
- describe('calculateSnapshotVersion', () => {
15
- beforeEach(() => {
16
- git.getCommitTag.mockReturnValue('13246u')
17
- getConfig.mockReturnValue({
18
- DEPLOY_ON_DOCKER: true,
19
- PRODUCTION_BRANCH: 'production',
20
- DOCKER_REPOSITORY: 'owner',
21
- DOCKER_HUB_ID: 'login',
22
- DOCKER_HUB_PWD: 'password'
23
- })
24
- })
25
- it('should return the snapshot version', () => {
26
- const context = {
27
- nextRelease: { type: 'patch' },
28
- lastRelease: {
29
- version: '1.0.0'
30
- }
31
- }
32
-
33
- const version = calculateSnapshotVersion(context)
34
- expect(git.getCommitTag).toHaveBeenCalledWith(context.config.REF_COMMIT)
35
- expect(version).toEqual('1.0.1-beta13246u')
36
- })
37
-
38
- it('should return the snapshot version', () => {
39
- const context = {
40
- nextRelease: { type: 'minor' },
41
- lastRelease: {
42
- version: '1.0.0'
43
- },
44
- config: {
45
- REF_COMMIT: 'REF_COMMIT'
46
- }
47
- }
48
-
49
- const version = calculateSnapshotVersion(context)
50
- expect(git.getCommitTag).toHaveBeenCalledWith(context.config.REF_COMMIT)
51
- expect(version).toEqual('1.1.0-beta13246u')
52
- })
53
-
54
- it('should return the snapshot version', () => {
55
- const context = {
56
- nextRelease: { type: 'major' },
57
- lastRelease: {
58
- version: '1.0.0'
59
- },
60
- config: {
61
- REF_COMMIT: 'REF_COMMIT'
62
- }
63
- }
64
-
65
- const version = calculateSnapshotVersion(context)
66
- expect(git.getCommitTag).toHaveBeenCalledWith(context.config.REF_COMMIT)
67
- expect(version).toEqual('2.0.0-beta13246u')
68
- })
69
- })
@@ -1,11 +0,0 @@
1
- import { logSection } from './log-section.js'
2
-
3
- export function displayPackageInfo (context) {
4
- logSection('Package Info', context)
5
- context.logger.info('Name : ' + context.config.PROJECT_NAME)
6
- context.logger.info('Version : ' + context.lastRelease.version)
7
- context.logger.info('Repository : ' + context.config.REPOSITORY_URL)
8
- context.logger.info('Branch : ' + context.branch.name)
9
- context.logger.info('Tag : ' + context.lastRelease.gitTag)
10
- context.logger.info('GitHead : ' + context.lastRelease.gitHead)
11
- }
@@ -1,12 +0,0 @@
1
- import { logSection } from './log-section.js'
2
-
3
- export function displayReleaseInfo (context) {
4
- logSection('Release Info', context)
5
- context.logger.info('Branch : ' + context.branch.name)
6
- context.logger.info('Build N° : ' + context.config.BUILD_NUMBER)
7
- context.logger.info('Version : ' + context.nextRelease.version)
8
- context.logger.info('Tag : ' + context.nextRelease.gitTag)
9
- context.logger.info('GitHead : ' + context.nextRelease.gitHead)
10
- context.logger.info('Type : ' + context.nextRelease.type)
11
- context.logger.info('Channel : ' + context.nextRelease.channel)
12
- }
@@ -1,45 +0,0 @@
1
- import { docker } from '../../common/index.js'
2
-
3
- function mapTags (tags) {
4
- tags = tags
5
- .map(tag => {
6
- return {
7
- name: tag.name,
8
- date: new Date(tag.last_updated).getTime()
9
- }
10
- }).sort((a, b) => b.date - a.date)
11
-
12
- let tagFound = false
13
-
14
- return tags.reduce((result, tag) => {
15
- if (tag.name.match(/\d+\.\d+\.\d+/)) {
16
- tagFound = true
17
- } else if (tagFound) {
18
- result.push(tag)
19
- }
20
- return result
21
- }, [])
22
- }
23
-
24
- export async function dockerCleanTags (context) {
25
- const { logger, config: { DOCKER_HUB_ID, DOCKER_HUB_PWD, DOCKER_REPOSITORY } } = context
26
-
27
- if (DOCKER_HUB_ID && DOCKER_HUB_PWD) {
28
- logger.info('Start clean Docker Hub...')
29
-
30
- const token = await docker.getToken(DOCKER_HUB_ID, DOCKER_HUB_PWD)
31
- const options = {
32
- token,
33
- repository: DOCKER_REPOSITORY
34
- }
35
-
36
- const tags = mapTags(await docker.getTags(options))
37
-
38
- await Promise.all(tags.map(async (tag) => {
39
- await docker.deleteTag(tag.name, options)
40
- logger.info(`TAG : ${tag.name} deleted`)
41
- }))
42
-
43
- logger.info('Docker Hub Clean !')
44
- }
45
- }
@@ -1,63 +0,0 @@
1
- import { beforeEach, describe, expect, it, jest } from '@jest/globals'
2
-
3
- jest.unstable_mockModule('../../common', () => {
4
- return {
5
- docker: {
6
- getToken: jest.fn(),
7
- getTags: jest.fn(),
8
- deleteTag: jest.fn()
9
- }
10
- }
11
- })
12
- const { docker } = await import('../../common/index.js')
13
- const { dockerCleanTags } = await import('./docker-clean-tags.js')
14
-
15
- describe('dockerCleanTags', () => {
16
- beforeEach(() => {
17
- docker.getToken.mockReturnValue('token')
18
- docker.getTags.mockReturnValue([
19
- {
20
- name: 'branch-1',
21
- last_updated: new Date('2020-06-01')
22
- },
23
- {
24
- name: '1.1.0',
25
- last_updated: new Date('2020-05-20')
26
- },
27
- {
28
- name: 'branch-2',
29
- last_updated: new Date('2020-05-01')
30
- },
31
- {
32
- name: '1.0.0',
33
- last_updated: new Date('2020-04-01')
34
- }
35
- ])
36
- })
37
- it('should clean obsolete tags', async () => {
38
- const context = {
39
- logger: {
40
- info: jest.fn(),
41
- warn: jest.fn()
42
- },
43
- config: {
44
- DOCKER_HUB_ID: 'DOCKER_HUB_ID',
45
- DOCKER_HUB_PWD: 'DOCKER_HUB_PWD',
46
- DOCKER_REPOSITORY: 'DOCKER_REPOSITORY'
47
- }
48
- }
49
-
50
- await dockerCleanTags(context)
51
-
52
- expect(docker.getToken).toHaveBeenCalledWith('DOCKER_HUB_ID', 'DOCKER_HUB_PWD')
53
- expect(docker.getTags).toHaveBeenCalledWith({
54
- token: 'token',
55
- repository: 'DOCKER_REPOSITORY'
56
- })
57
- expect(docker.deleteTag).toHaveBeenCalledWith('branch-2', {
58
- token: 'token',
59
- repository: 'DOCKER_REPOSITORY'
60
- })
61
- expect(docker.deleteTag).toHaveBeenCalledTimes(1)
62
- })
63
- })
@@ -1,47 +0,0 @@
1
- import { heroku } from '../../common/cli/heroku.js'
2
- import { docker } from '../../common/cli/docker.js'
3
- import { getConfig } from '../../common/get-config.js'
4
-
5
- export async function dockerPublish (context) {
6
- context.config = getConfig()
7
- const { logger, config: { DEPLOY_ON_DOCKER, DEPLOY_ON_HEROKU, SKIP_DEPLOY } } = context
8
-
9
- if (!SKIP_DEPLOY) {
10
- if (DEPLOY_ON_DOCKER) {
11
- await deployOnDockerHub(context)
12
- } else {
13
- logger.info('Skip docker publish DEPLOY_ON_DOCKER: ', DEPLOY_ON_DOCKER)
14
- }
15
-
16
- if (DEPLOY_ON_HEROKU) {
17
- await deployOnHeroku(context)
18
- } else {
19
- logger.info('Skip heroku publish DEPLOY_ON_HEROKU: ', DEPLOY_ON_HEROKU)
20
- }
21
- } else {
22
- logger.info('Skip docker/heroku publish SKIP_DEPLOY: ', SKIP_DEPLOY)
23
- }
24
- }
25
-
26
- export async function deployOnDockerHub (context) {
27
- context.config = getConfig()
28
- const { logger, config: { PRODUCTION_BRANCH, DOCKER_REPOSITORY, DOCKER_HUB_ID, DOCKER_HUB_PWD } } = context
29
-
30
- docker.login('-u', DOCKER_HUB_ID, '-p', DOCKER_HUB_PWD)
31
-
32
- const image = PRODUCTION_BRANCH === context.branch.name ? `${DOCKER_REPOSITORY}:${context.nextRelease.version}` : `${DOCKER_REPOSITORY}:${context.branch.name}`
33
- logger.info('context.branch.name : ', context.branch.name)
34
- logger.info('context.nextRelease.version : ', context.nextRelease && context.nextRelease.version)
35
- logger.info('PRODUCTION_BRANCH : ', PRODUCTION_BRANCH)
36
- docker.tag(`${DOCKER_REPOSITORY}:latest`, image)
37
-
38
- await docker.push(image)
39
- }
40
-
41
- export async function deployOnHeroku (context) {
42
- const { config: { HEROKU_APP } } = context
43
-
44
- heroku.containerLogin().sync()
45
- await heroku.containerPush('web', '-a', HEROKU_APP)
46
- await heroku.containerRelease('web', '-a', HEROKU_APP)
47
- }
@@ -1,67 +0,0 @@
1
- import { describe, expect, it, jest } from '@jest/globals'
2
-
3
- jest.unstable_mockModule('../../common/cli/docker.js', () => {
4
- return {
5
- docker: {
6
- login: jest.fn(),
7
- tag: jest.fn(),
8
- push: jest.fn()
9
- }
10
- }
11
- })
12
-
13
- jest.unstable_mockModule('../../common/get-config.js', () => {
14
- return {
15
- getConfig: jest.fn()
16
- }
17
- })
18
- const { docker } = await import('../../common/cli/docker.js')
19
- const { getConfig } = await import('../../common/get-config.js')
20
- const { dockerPublish } = await import('./docker-publish.js')
21
-
22
- describe('dockerPublish', () => {
23
- it('should publish docker image', async () => {
24
- getConfig.mockReturnValue({
25
- DEPLOY_ON_DOCKER: true,
26
- PRODUCTION_BRANCH: 'production',
27
- DOCKER_REPOSITORY: 'owner',
28
- DOCKER_HUB_ID: 'login',
29
- DOCKER_HUB_PWD: 'password'
30
- })
31
- const context = {
32
- logger: {
33
- info: jest.fn(),
34
- warn: jest.fn()
35
- },
36
- branch: {
37
- name: 'branch-name'
38
- }
39
- }
40
- await dockerPublish(context)
41
-
42
- expect(docker.login).toHaveBeenCalledWith('-u', 'login', '-p', 'password')
43
- expect(docker.tag).toHaveBeenCalledWith('owner:latest', 'owner:branch-name')
44
- expect(docker.push).toHaveBeenCalledWith('owner:branch-name')
45
- })
46
- it('should do nothing', async () => {
47
- getConfig.mockReturnValue({
48
- DEPLOY_ON_DOCKER: false,
49
- PRODUCTION_BRANCH: 'production',
50
- DOCKER_REPOSITORY: 'owner',
51
- DOCKER_HUB_ID: 'login',
52
- DOCKER_HUB_PWD: 'password'
53
- })
54
- const context = {
55
- logger: {
56
- info: jest.fn(),
57
- warn: jest.fn()
58
- },
59
- branch: {
60
- name: 'branch-name'
61
- }
62
- }
63
- await dockerPublish(context)
64
-
65
- expect(docker.login).not.toHaveBeenCalled()
66
- })
67
- })
@@ -1,16 +0,0 @@
1
- import { join } from 'path'
2
- import { writeFileSync } from 'fs'
3
- import { git } from '../../common/index.js'
4
-
5
- export async function ghPagesPublish (context) {
6
- const { config: { GITHUB_PAGES_PATH: cwd, GH_TOKEN, REPOSITORY_URL } } = context
7
- const repository = REPOSITORY_URL.replace('https://', '')
8
-
9
- writeFileSync(join(cwd, '.nojekyll'), '', { encoding: 'utf8' })
10
-
11
- git.init().cwd(cwd).sync()
12
- git.add('-A').cwd(cwd).sync()
13
- git.commit('-m', 'Deploy documentation v' + context.nextRelease.version).cwd(cwd).sync()
14
-
15
- await git.push('-f', GH_TOKEN ? `https://${GH_TOKEN}@${repository}` : `https://${repository}`, 'master:gh-pages').cwd(cwd)
16
- }
@@ -1,5 +0,0 @@
1
- export function logSection (title, context) {
2
- context.logger.info('-----------------------------------')
3
- context.logger.info(`--- ${title}`)
4
- context.logger.info('-----------------------------------')
5
- }