Skip to content

Commit

Permalink
operation for specific images
Browse files Browse the repository at this point in the history
  • Loading branch information
identw committed Feb 26, 2024
1 parent 076551c commit 1213702
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion js-action/dist/main.js

Large diffs are not rendered by default.

18 changes: 16 additions & 2 deletions js-action/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,14 @@ async function main() {
createDir('copy-files');

for (const image of buildOpts) {

const imageTag = `${registry}/${repoName}/${image.name}:${tag}`;
if (!image.hasOwnProperty('operation')) {
image['operation'] = 'build-and-push';
}
let resultTag = tag;
if (image.operation === 'build') {
resultTag = `0000001-${generateRandomString(8)}`;
}
const imageTag = `${registry}/${repoName}/${image.name}:${resultTag}`;
console.log(`Build image: ${imageTag}`);
builtImages[image.name] = imageTag;

Expand Down Expand Up @@ -88,6 +94,14 @@ async function main() {

let prePushImages = [];
for (const image of buildOpts) {
if (!image.hasOwnProperty('operation')) {
image['operation'] = 'build-and-push';
}
console.log(`${image.name} operation ${image.operation}`);
if (image.operation !== 'push' && image.operation !== 'build-and-push') {
continue;
}

const imageTag = `${registry}/${repoName}/${image.name}:${tag}`;
const prePushTag = `0000001-${generateRandomString(8)}`;
const imagePrePushTag = `${registry}/${repoName}/${image.name}:${prePushTag}`;
Expand Down

0 comments on commit 1213702

Please sign in to comment.