aboutsummaryrefslogtreecommitdiff
path: root/.github/devcontainers-action/lib/main.js
diff options
context:
space:
mode:
Diffstat (limited to '.github/devcontainers-action/lib/main.js')
-rw-r--r--.github/devcontainers-action/lib/main.js62
1 files changed, 37 insertions, 25 deletions
diff --git a/.github/devcontainers-action/lib/main.js b/.github/devcontainers-action/lib/main.js
index fca18f2..69506b7 100644
--- a/.github/devcontainers-action/lib/main.js
+++ b/.github/devcontainers-action/lib/main.js
@@ -44,42 +44,51 @@ function run() {
core.debug('Reading input parameters...');
// Read inputs
const shouldPublishFeatures = core.getInput('publish-features').toLowerCase() === 'true';
- const shouldPublishTemplate = core.getInput('publish-templates').toLowerCase() === 'true';
+ const shouldPublishTemplates = core.getInput('publish-templates').toLowerCase() === 'true';
const shouldGenerateDocumentation = core.getInput('generate-docs').toLowerCase() === 'true';
+ // Experimental
+ const shouldTagIndividualFeatures = core.getInput('tag-individual-features').toLowerCase() === 'true';
+ const shouldPublishToNPM = core.getInput('publish-to-npm').toLowerCase() === 'true';
+ const shouldPublishReleaseArtifacts = core.getInput('publish-release-artifacts').toLowerCase() === 'true';
+ const shouldPublishToOCI = core.getInput('publish-to-oci').toLowerCase() === 'true';
+ const opts = {
+ shouldTagIndividualFeatures,
+ shouldPublishToNPM,
+ shouldPublishReleaseArtifacts,
+ shouldPublishToOCI
+ };
+ const featuresBasePath = core.getInput('base-path-to-features');
+ const templatesBasePath = core.getInput('base-path-to-templates');
let featuresMetadata = undefined;
let templatesMetadata = undefined;
+ // -- Package Release Artifacts
if (shouldPublishFeatures) {
core.info('Publishing features...');
- const featuresBasePath = core.getInput('base-path-to-features');
- featuresMetadata = yield packageFeatures(featuresBasePath);
+ featuresMetadata = yield packageFeatures(featuresBasePath, opts);
}
- if (shouldPublishTemplate) {
+ if (shouldPublishTemplates) {
core.info('Publishing template...');
- const basePathToDefinitions = core.getInput('base-path-to-templates');
- templatesMetadata = undefined; // TODO
- yield packageTemplates(basePathToDefinitions);
+ templatesMetadata = yield packageTemplates(templatesBasePath);
}
- if (shouldGenerateDocumentation) {
- core.info('Generating documentation...');
- const featuresBasePath = core.getInput('base-path-to-features');
- if (featuresBasePath) {
- yield (0, generateDocs_1.generateFeaturesDocumentation)(featuresBasePath);
- }
- else {
- core.error("'base-path-to-features' input is required to generate documentation");
- }
- // TODO: base-path-to-templates
+ // -- Generate Documentation
+ if (shouldGenerateDocumentation && featuresBasePath) {
+ core.info('Generating documentation for features...');
+ yield (0, generateDocs_1.generateFeaturesDocumentation)(featuresBasePath);
}
- // TODO: Programatically add feature/template fino with relevant metadata for UX clients.
- core.info('Generation metadata file: devcontainer-collection.json');
- yield (0, utils_1.addCollectionsMetadataFile)(featuresMetadata, templatesMetadata);
+ if (shouldGenerateDocumentation && templatesBasePath) {
+ core.info('Generating documentation for templates...');
+ yield (0, generateDocs_1.generateTemplateDocumentation)(templatesBasePath);
+ }
+ // -- Programatically add feature/template metadata to collections file.
+ core.info('Generating metadata file: devcontainer-collection.json');
+ yield (0, utils_1.addCollectionsMetadataFile)(featuresMetadata, templatesMetadata, opts);
});
}
-function packageFeatures(basePath) {
+function packageFeatures(basePath, opts) {
return __awaiter(this, void 0, void 0, function* () {
try {
core.info(`Archiving all features in ${basePath}`);
- const metadata = yield (0, utils_1.getFeaturesAndPackage)(basePath);
+ const metadata = yield (0, utils_1.getFeaturesAndPackage)(basePath, opts);
core.info('Packaging features has finished.');
return metadata;
}
@@ -94,14 +103,17 @@ function packageFeatures(basePath) {
function packageTemplates(basePath) {
return __awaiter(this, void 0, void 0, function* () {
try {
- core.info(`Archiving all templated in ${basePath}`);
- yield (0, utils_1.getTemplatesAndPackage)(basePath);
+ core.info(`Archiving all templates in ${basePath}`);
+ const metadata = yield (0, utils_1.getTemplatesAndPackage)(basePath);
core.info('Packaging templates has finished.');
+ return metadata;
}
catch (error) {
- if (error instanceof Error)
+ if (error instanceof Error) {
core.setFailed(error.message);
+ }
}
+ return;
});
}
run();