Skip to content
This repository was archived by the owner on Oct 7, 2024. It is now read-only.

Commit 7740985

Browse files
author
Jon Irving
authored
Merge pull request #3 from xapix-io/j0ni/ops
Pulumi infrastructure deployment
2 parents 6ace144 + 7744dd8 commit 7740985

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+4049
-2
lines changed

.github/actions/docker/action.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: 'Build and publish docker image'
2+
inputs:
3+
password:
4+
description: Your GitHub password corresponding to write access to the repo where this action is called.
5+
required: true
6+
username:
7+
description: Your GitHub password corresponding to write access to the repo where this action is called.
8+
require: true
9+
image_name:
10+
description: name of the image. Example - myContainer
11+
require: true
12+
build_context:
13+
description: the path in your repo that will serve as the build context
14+
require: true
15+
default: './'
16+
dockerfile_path:
17+
description: the full path (including the filename) to the dockerfile that you want to build
18+
require: true
19+
default: ./Dockerfile
20+
build_params:
21+
description: additional build params
22+
require: false
23+
default: ''
24+
outputs:
25+
IMAGE_SHA_NAME:
26+
description: name of the Docker Image including the tag
27+
IMAGE_URL:
28+
description: the URL where you can view the hosted image on GitHub.
29+
runs:
30+
using: 'node12'
31+
main: 'index.js'

.github/actions/docker/index.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
const core = require('@actions/core');
2+
const { exec } = require('@actions/exec');
3+
4+
return async function () {
5+
try {
6+
const githubSHA = process.env['GITHUB_SHA'];
7+
const dockerfile = core.getInput('dockerfile_path', { required: true });
8+
const buildContext = core.getInput('build_context', { required: true });
9+
var buildParams = core.getInput('build_params');
10+
const baseName = core.getInput('image_name', { required: true });
11+
const username = core.getInput('username', { required: true });
12+
const password = core.getInput('password', { required: true });
13+
14+
const shaName = `${baseName}:${githubSHA}`;
15+
const developName = `${baseName}:develop`;
16+
17+
await exec(`docker login -u ${username} -p ${password}`);
18+
if (core.getInput('cache')) {
19+
await exec(`docker pull ${baseName}`);
20+
buildParams += ` --cache-from ${baseName}`;
21+
}
22+
await exec(`docker build ${buildParams} -f ${dockerfile} -t ${developName} -t ${shaName} ${buildContext}`);
23+
let promises = [exec(`docker push ${shaName}`)];
24+
if ('refs/heads/master' == process.env['GITHUB_REF']) {
25+
promises.push(exec(`docker push ${developName}`));
26+
}
27+
await Promise.all(promises);
28+
} catch (error) {
29+
core.setFailed(error.message);
30+
}
31+
}()

.github/actions/docker/node_modules/@actions/core/LICENSE.md

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/actions/docker/node_modules/@actions/core/README.md

Lines changed: 147 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/actions/docker/node_modules/@actions/core/lib/command.d.ts

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/actions/docker/node_modules/@actions/core/lib/command.js

Lines changed: 79 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/actions/docker/node_modules/@actions/core/lib/command.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)