@codedependant/semantic-release-docker 5.1.0 → 6.0.0
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.
- package/CHANGELOG.md +29 -0
- package/index.js +22 -13
- package/lib/build-config.js +59 -3
- package/lib/publish.js +3 -3
- package/package.json +15 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# Semantic Release Docker
|
|
2
2
|
|
|
3
|
+
# [6.0.0](https://github.com/esatterwhite/semantic-release-docker/compare/v5.1.1...v6.0.0) (2026-04-06)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Chores
|
|
7
|
+
|
|
8
|
+
* **ci**: update github workflow for recent version of semantic release [66bfaa4](https://github.com/esatterwhite/semantic-release-docker/commit/66bfaa4d2942f401b0cecab5ec15c3d5396b4606) - Eric Satterwhite
|
|
9
|
+
* **deps**: actions/core@3.0.0 [f24c6ba](https://github.com/esatterwhite/semantic-release-docker/commit/f24c6babf1d51824f16e2333d78142741ad3cefc) - Eric Satterwhite, closes: [#65](https://github.com/esatterwhite/semantic-release-docker/issues/65)
|
|
10
|
+
* **pkg**: fix start / stop scripts [1136737](https://github.com/esatterwhite/semantic-release-docker/commit/1136737172d0977f97541d7332642ebf03fbd647) - Eric Satterwhite
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### **BREAKING CHANGES**
|
|
14
|
+
|
|
15
|
+
* **ci:** minimum node versions >=20
|
|
16
|
+
|
|
17
|
+
## [5.1.1](https://github.com/esatterwhite/semantic-release-docker/compare/v5.1.0...v5.1.1) (2025-05-24)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **ci**: update actions runner dependencies [1f23b01](https://github.com/esatterwhite/semantic-release-docker/commit/1f23b01b6f8ddec193eada6e9a441bba95c739dc) - Eric Satterwhite
|
|
23
|
+
* **plugin**: better support for multiple plugin instances [8b6621c](https://github.com/esatterwhite/semantic-release-docker/commit/8b6621c60a4ba40d16d5ed026cd49c23396c6e98) - Eric Satterwhite, closes: [#60](https://github.com/esatterwhite/semantic-release-docker/issues/60)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Chores
|
|
27
|
+
|
|
28
|
+
* **compose**: update docker registry certs [4513f83](https://github.com/esatterwhite/semantic-release-docker/commit/4513f83a3eb9eb0bdab4e05ef132290cfccc0f8e) - Eric Satterwhite
|
|
29
|
+
* **deps**: object-hash@3.0.0 [e04e9d3](https://github.com/esatterwhite/semantic-release-docker/commit/e04e9d373c44c6145ebae3170d2b878dedccafc5) - Eric Satterwhite
|
|
30
|
+
* **deps**: stream-buffers@3.0.3 [b937a46](https://github.com/esatterwhite/semantic-release-docker/commit/b937a4693ab054d3496a6f902024cd70ff7c7543) - Eric Satterwhite
|
|
31
|
+
|
|
3
32
|
# [5.1.0](https://github.com/esatterwhite/semantic-release-docker/compare/v5.0.4...v5.1.0) (2024-12-30)
|
|
4
33
|
|
|
5
34
|
|
package/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const crypto = require('crypto')
|
|
4
3
|
const docker = require('./lib/docker/index.js')
|
|
5
4
|
const dockerPrepare = require('./lib/prepare.js')
|
|
6
5
|
const dockerVerify = require('./lib/verify.js')
|
|
@@ -8,9 +7,9 @@ const dockerPublish = require('./lib/publish.js')
|
|
|
8
7
|
const buildConfig = require('./lib/build-config.js')
|
|
9
8
|
const dockerSuccess = require('./lib/success.js')
|
|
10
9
|
const dockerFail = require('./lib/fail.js')
|
|
11
|
-
const build_id = crypto.randomBytes(10).toString('hex')
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
// map multiple images to a unique sha
|
|
12
|
+
const IMAGES = new Map()
|
|
14
13
|
module.exports = {
|
|
15
14
|
buildConfig
|
|
16
15
|
, fail
|
|
@@ -22,31 +21,41 @@ module.exports = {
|
|
|
22
21
|
|
|
23
22
|
/* istanbul ignore next */
|
|
24
23
|
async function fail(config, context) {
|
|
25
|
-
const opts = await buildConfig(
|
|
26
|
-
|
|
24
|
+
const opts = await buildConfig(null, config, context)
|
|
25
|
+
const image = IMAGES.get(opts.build) || docker.Image.from(opts, context)
|
|
26
|
+
context.image = image
|
|
27
|
+
IMAGES.set(opts.build, image)
|
|
27
28
|
return dockerFail(opts, context)
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
async function prepare(config, context) {
|
|
31
|
-
const opts = await buildConfig(
|
|
32
|
-
image = await dockerPrepare(opts, context)
|
|
32
|
+
const opts = await buildConfig(null, config, context)
|
|
33
|
+
const image = await dockerPrepare(opts, context)
|
|
34
|
+
IMAGES.set(opts.build, image)
|
|
33
35
|
return image
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
async function publish(config, context) {
|
|
37
|
-
const opts = await buildConfig(
|
|
38
|
-
|
|
39
|
+
const opts = await buildConfig(null, config, context)
|
|
40
|
+
const image = IMAGES.get(opts.build) || docker.Image.from(opts, context)
|
|
41
|
+
context.image = image
|
|
42
|
+
IMAGES.set(opts.build, image)
|
|
39
43
|
return dockerPublish(opts, context)
|
|
40
44
|
}
|
|
41
45
|
|
|
42
46
|
async function success(config, context) {
|
|
43
|
-
const opts = await buildConfig(
|
|
44
|
-
|
|
47
|
+
const opts = await buildConfig(null, config, context)
|
|
48
|
+
const image = IMAGES.get(opts.build) || docker.Image.from(opts, context)
|
|
49
|
+
context.image = image
|
|
50
|
+
IMAGES.set(opts.build, image)
|
|
45
51
|
return dockerSuccess(opts, context)
|
|
46
52
|
}
|
|
47
53
|
|
|
48
54
|
async function verifyConditions(config, context) {
|
|
49
|
-
const opts = await buildConfig(
|
|
50
|
-
|
|
55
|
+
const opts = await buildConfig(null, config, context)
|
|
56
|
+
const image = IMAGES.get(opts.build) || docker.Image.from(opts, context)
|
|
57
|
+
context.image = image
|
|
58
|
+
IMAGES.set(opts.build, image)
|
|
51
59
|
return dockerVerify(opts, context)
|
|
52
60
|
}
|
|
61
|
+
|
package/lib/build-config.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
const hash = require('object-hash')
|
|
3
4
|
const path = require('path')
|
|
4
5
|
const readPkg = require('./read-pkg.js')
|
|
5
6
|
const object = require('./lang/object/index.js')
|
|
@@ -7,10 +8,13 @@ const array = require('./lang/array/index.js')
|
|
|
7
8
|
const parsePkgName = require('./parse-pkg-name.js')
|
|
8
9
|
const typeCast = require('./lang/string/typecast.js')
|
|
9
10
|
const PWD = '.'
|
|
11
|
+
const PID = `${process.pid}`
|
|
12
|
+
const TIMESTAMP = new Date().toISOString()
|
|
10
13
|
|
|
11
14
|
module.exports = buildConfig
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
function applyDefaults(config) {
|
|
17
|
+
|
|
14
18
|
const {
|
|
15
19
|
dockerFile: dockerfile = 'Dockerfile'
|
|
16
20
|
, dockerNoCache: nocache = false
|
|
@@ -31,9 +35,54 @@ async function buildConfig(build_id, config, context) {
|
|
|
31
35
|
, dryRun: dry_run = false
|
|
32
36
|
} = config
|
|
33
37
|
|
|
38
|
+
return {
|
|
39
|
+
dockerfile
|
|
40
|
+
, nocache
|
|
41
|
+
, tags
|
|
42
|
+
, args
|
|
43
|
+
, build_flags
|
|
44
|
+
, cache_from
|
|
45
|
+
, registry
|
|
46
|
+
, login
|
|
47
|
+
, image
|
|
48
|
+
, platform
|
|
49
|
+
, publish
|
|
50
|
+
, dockerContext
|
|
51
|
+
, verifycmd
|
|
52
|
+
, network
|
|
53
|
+
, clean
|
|
54
|
+
, quiet
|
|
55
|
+
, dry_run
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async function buildConfig(build_id, config, context) {
|
|
34
60
|
let name = null
|
|
35
61
|
let scope = null
|
|
36
62
|
let pkg = {}
|
|
63
|
+
|
|
64
|
+
const normalized = applyDefaults(config)
|
|
65
|
+
|
|
66
|
+
const {
|
|
67
|
+
dockerfile
|
|
68
|
+
, nocache
|
|
69
|
+
, tags
|
|
70
|
+
, args
|
|
71
|
+
, build_flags
|
|
72
|
+
, cache_from
|
|
73
|
+
, registry
|
|
74
|
+
, login
|
|
75
|
+
, image
|
|
76
|
+
, platform
|
|
77
|
+
, publish
|
|
78
|
+
, dockerContext
|
|
79
|
+
, verifycmd
|
|
80
|
+
, network
|
|
81
|
+
, clean
|
|
82
|
+
, quiet
|
|
83
|
+
, dry_run
|
|
84
|
+
} = normalized
|
|
85
|
+
|
|
37
86
|
try {
|
|
38
87
|
pkg = await readPkg({cwd: context.cwd})
|
|
39
88
|
const parsed = parsePkgName(pkg.name)
|
|
@@ -48,7 +97,7 @@ async function buildConfig(build_id, config, context) {
|
|
|
48
97
|
|
|
49
98
|
if (cache_from) build_flags.cache_from = array.toArray(cache_from)
|
|
50
99
|
|
|
51
|
-
|
|
100
|
+
const configuration = {
|
|
52
101
|
registry
|
|
53
102
|
, dockerfile
|
|
54
103
|
, nocache
|
|
@@ -71,7 +120,7 @@ async function buildConfig(build_id, config, context) {
|
|
|
71
120
|
, ...(args || {})
|
|
72
121
|
}
|
|
73
122
|
, name: image || name
|
|
74
|
-
, build:
|
|
123
|
+
, build: null
|
|
75
124
|
, login: login
|
|
76
125
|
, env: context.env
|
|
77
126
|
, context: dockerContext
|
|
@@ -80,4 +129,11 @@ async function buildConfig(build_id, config, context) {
|
|
|
80
129
|
, clean: typeCast(clean) === true
|
|
81
130
|
, platform: array.toArray(platform)
|
|
82
131
|
}
|
|
132
|
+
|
|
133
|
+
configuration.build = build_id || genBuildId(normalized)
|
|
134
|
+
return configuration
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function genBuildId(configuration) {
|
|
138
|
+
return hash([configuration, PID, TIMESTAMP], {algorithm: 'sha256'})
|
|
83
139
|
}
|
package/lib/publish.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const actions = require('@actions/core')
|
|
4
3
|
const docker = require('./docker/index.js')
|
|
5
4
|
|
|
6
5
|
module.exports = publish
|
|
7
6
|
|
|
8
7
|
async function publish(opts, context) {
|
|
8
|
+
const actions = await import('@actions/core')
|
|
9
9
|
const {image = docker.Image.from(opts, context)} = context
|
|
10
10
|
|
|
11
11
|
const sha = image.sha || opts.build_id
|
|
12
12
|
const sha256 = image.sha256 || opts.build_id
|
|
13
13
|
|
|
14
14
|
actions.setOutput('docker_image', image.repo)
|
|
15
|
-
actions.setOutput('docker_image_build_id', opts.build_id)
|
|
15
|
+
actions.setOutput('docker_image_build_id', image.opts.build_id)
|
|
16
16
|
actions.setOutput('docker_image_sha_short', sha)
|
|
17
17
|
actions.setOutput('docker_image_sha_long', sha256)
|
|
18
18
|
|
|
19
19
|
actions.exportVariable('SEMANTIC_RELEASE_DOCKER_IMAGE', image.repo)
|
|
20
|
-
actions.exportVariable('SEMANTIC_RELEASE_DOCKER_IMAGE_BUILD_ID', opts.build_id)
|
|
20
|
+
actions.exportVariable('SEMANTIC_RELEASE_DOCKER_IMAGE_BUILD_ID', image.opts.build_id)
|
|
21
21
|
actions.exportVariable('SEMANTIC_RELEASE_DOCKER_IMAGE_SHA_SHORT', sha)
|
|
22
22
|
actions.exportVariable('SEMANTIC_RELEASE_DOCKER_IMAGE_SHA_LONG', sha256)
|
|
23
23
|
await image.push()
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codedependant/semantic-release-docker",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "6.0.0",
|
|
5
5
|
"description": "docker package",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"files": [
|
|
@@ -12,17 +12,20 @@
|
|
|
12
12
|
"package.json",
|
|
13
13
|
"index.js"
|
|
14
14
|
],
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": ">=20"
|
|
17
|
+
},
|
|
15
18
|
"scripts": {
|
|
16
|
-
"test": "docker
|
|
17
|
-
"start": "docker
|
|
18
|
-
"stop": "docker
|
|
19
|
+
"test": "docker compose -f compose/base.yml -f compose/test.yml up --exit-code-from semantic-release --force-recreate --remove-orphans --build",
|
|
20
|
+
"start": "docker compose -f compose/base.yml -f compose/dev.yml up --force-recreate --remove-orphans --build",
|
|
21
|
+
"stop": "docker compose -f compose/base.yml -f compose/dev.yml down",
|
|
19
22
|
"tap": "tap",
|
|
20
23
|
"lint": "eslint .",
|
|
21
24
|
"lint:fix": "npm run lint -- --fix",
|
|
22
25
|
"local": "env $(cat env/local.env)",
|
|
23
26
|
"pretap": "npm run lint",
|
|
24
|
-
"release": "semantic-release",
|
|
25
|
-
"release:dry": "
|
|
27
|
+
"release": "npx semantic-release",
|
|
28
|
+
"release:dry": "npm run release -- --no-ci --dry-run --branches=${BRANCH_NAME:-main}"
|
|
26
29
|
},
|
|
27
30
|
"keywords": [
|
|
28
31
|
"semantic-release"
|
|
@@ -66,22 +69,22 @@
|
|
|
66
69
|
]
|
|
67
70
|
},
|
|
68
71
|
"devDependencies": {
|
|
69
|
-
"@codedependant/release-config-
|
|
70
|
-
"@semantic-release/changelog": "^
|
|
71
|
-
"@semantic-release/git": "^9.0.0",
|
|
72
|
-
"@semantic-release/github": "^7.0.7",
|
|
72
|
+
"@codedependant/release-config-core": "^1.1.1",
|
|
73
|
+
"@semantic-release/changelog": "^6.0.3",
|
|
73
74
|
"eslint": "^8.5.0",
|
|
74
75
|
"eslint-config-codedependant": "^3.0.0",
|
|
75
|
-
"semantic-release": "
|
|
76
|
+
"semantic-release": "^25.0.3",
|
|
76
77
|
"sinon": "^9.0.2",
|
|
78
|
+
"stream-buffers": "^3.0.3",
|
|
77
79
|
"tap": "^16.0.0"
|
|
78
80
|
},
|
|
79
81
|
"dependencies": {
|
|
80
|
-
"@actions/core": "^
|
|
82
|
+
"@actions/core": "^3.0.0",
|
|
81
83
|
"@semantic-release/error": "^3.0.0",
|
|
82
84
|
"debug": "^4.1.1",
|
|
83
85
|
"execa": "^4.0.2",
|
|
84
86
|
"handlebars": "^4.7.7",
|
|
87
|
+
"object-hash": "^3.0.0",
|
|
85
88
|
"semver": "^7.3.2"
|
|
86
89
|
}
|
|
87
90
|
}
|