-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(plugin): add basic support for github actions
There have been several requests to gain access or over ride the build id of the image so that the caller can control that and reference it later in a build process. Initial attempts to expose this information from the nextRelease property. Unfortunately, this object seems to be sandboxed, and additional information is not carried to other plugins. As an alternative, this adds basic support for github actions be setting output and environment variable that include the build id and image sha where possible fixes: #49
- Loading branch information
1 parent
ad6a6a4
commit 3c96ccb
Showing
6 changed files
with
68 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,24 @@ | ||
'use strict' | ||
|
||
const actions = require('@actions/core') | ||
const docker = require('./docker/index.js') | ||
|
||
module.exports = publish | ||
|
||
async function publish(opts, context) { | ||
const image = docker.Image.from(opts, context) | ||
const {image = docker.Image.from(opts, context)} = context | ||
|
||
const sha = image.sha || opts.build_id | ||
const sha256 = image.sha256 || opts.build_id | ||
|
||
actions.setOutput('docker_image', image.repo) | ||
actions.setOutput('docker_image_build_id', opts.build_id) | ||
actions.setOutput('docker_image_sha_short', sha) | ||
actions.setOutput('docker_image_sha_long', sha256) | ||
|
||
actions.exportVariable('SEMANTIC_RELEASE_DOCKER_IMAGE', image.repo) | ||
actions.exportVariable('SEMANTIC_RELEASE_DOCKER_IMAGE_BUILD_ID', opts.build_id) | ||
actions.exportVariable('SEMANTIC_RELEASE_DOCKER_IMAGE_SHA_SHORT', sha) | ||
actions.exportVariable('SEMANTIC_RELEASE_DOCKER_IMAGE_SHA_LONG', sha256) | ||
await image.push() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters