@@ -53,7 +53,7 @@ const FEATURES_README_TEMPLATE = `
5353
5454\`\`\`json
5555"features": {
56- "#{Nwo }/#{Id}@#{VersionTag }": {
56+ "#{Registry }/#{Namespace}/#{ Id}:#{Version }": {
5757 "version": "latest"
5858 }
5959}
@@ -76,9 +76,9 @@ const TEMPLATE_README_TEMPLATE = `
7676
7777#{OptionsTable}
7878`;
79- function generateFeaturesDocumentation(basePath) {
79+ function generateFeaturesDocumentation(basePath, ociRegistry, namespace ) {
8080 return __awaiter(this, void 0, void 0, function* () {
81- yield _generateDocumentation(basePath, FEATURES_README_TEMPLATE, 'devcontainer-feature.json');
81+ yield _generateDocumentation(basePath, FEATURES_README_TEMPLATE, 'devcontainer-feature.json', ociRegistry, namespace );
8282 });
8383}
8484exports.generateFeaturesDocumentation = generateFeaturesDocumentation;
@@ -88,7 +88,7 @@ function generateTemplateDocumentation(basePath) {
8888 });
8989}
9090exports.generateTemplateDocumentation = generateTemplateDocumentation;
91- function _generateDocumentation(basePath, readmeTemplate, metadataFile) {
91+ function _generateDocumentation(basePath, readmeTemplate, metadataFile, ociRegistry = '', namespace = '' ) {
9292 return __awaiter(this, void 0, void 0, function* () {
9393 const directories = fs.readdirSync(basePath);
9494 yield Promise.all(directories.map((f) => __awaiter(this, void 0, void 0, function* () {
@@ -114,13 +114,15 @@ function _generateDocumentation(basePath, readmeTemplate, metadataFile) {
114114 return;
115115 }
116116 const srcInfo = (0, utils_1.getGitHubMetadata)();
117- const ref = srcInfo.ref;
118117 const owner = srcInfo.owner;
119118 const repo = srcInfo.repo;
120- // Add tag if parseable
121- let versionTag = 'latest';
122- if (ref && ref.includes('refs/tags/')) {
123- versionTag = ref.replace('refs/tags/', '');
119+ // Add version
120+ let version = 'latest';
121+ const parsedVersion = parsedJson === null || parsedJson === void 0 ? void 0 : parsedJson.version;
122+ if (parsedVersion) {
123+ // example - 1.0.0
124+ const splitVersion = parsedVersion.split('.');
125+ version = splitVersion[0];
124126 }
125127 const generateOptionsMarkdown = () => {
126128 const options = parsedJson === null || parsedJson === void 0 ? void 0 : parsedJson.options;
@@ -148,8 +150,9 @@ function _generateDocumentation(basePath, readmeTemplate, metadataFile) {
148150 .replace('#{Description}', (_a = parsedJson.description) !== null && _a !== void 0 ? _a : '')
149151 .replace('#{OptionsTable}', generateOptionsMarkdown())
150152 // Features Only
151- .replace('#{Nwo}', `${owner}/${repo}`)
152- .replace('#{VersionTag}', versionTag)
153+ .replace('#{Registry}', ociRegistry)
154+ .replace('#{Namespace}', namespace == '<owner>/<repo>' ? `${owner}/${repo}` : namespace)
155+ .replace('#{Version}', version)
153156 // Templates Only
154157 .replace('#{ManifestName}', (_c = (_b = parsedJson === null || parsedJson === void 0 ? void 0 : parsedJson.image) === null || _b === void 0 ? void 0 : _b.manifest) !== null && _c !== void 0 ? _c : '')
155158 .replace('#{RepoUrl}', urlToConfig);
@@ -232,6 +235,8 @@ function run() {
232235 };
233236 const featuresBasePath = core.getInput('base-path-to-features');
234237 const templatesBasePath = core.getInput('base-path-to-templates');
238+ const ociRegistry = core.getInput('oci-registry');
239+ const namespace = core.getInput('features-namespace');
235240 let featuresMetadata = undefined;
236241 let templatesMetadata = undefined;
237242 // -- Package Release Artifacts
@@ -246,7 +251,7 @@ function run() {
246251 // -- Generate Documentation
247252 if (shouldGenerateDocumentation && featuresBasePath) {
248253 core.info('Generating documentation for features...');
249- yield (0, generateDocs_1.generateFeaturesDocumentation)(featuresBasePath);
254+ yield (0, generateDocs_1.generateFeaturesDocumentation)(featuresBasePath, ociRegistry, namespace );
250255 }
251256 if (shouldGenerateDocumentation && templatesBasePath) {
252257 core.info('Generating documentation for templates...');
@@ -456,7 +461,7 @@ exports.addCollectionsMetadataFile = addCollectionsMetadataFile;
456461function pushArtifactToOCI(version, featureName, artifactPath) {
457462 return __awaiter(this, void 0, void 0, function* () {
458463 const exec = (0, util_1.promisify)(child_process.exec);
459- const versions = [version, '1.0', '1']; // TODO: don't hardcode ofc.
464+ const versions = [version, '1.0', '1', 'latest' ]; // TODO: Generate semantic versions from 'version'
460465 const sourceInfo = getGitHubMetadata();
461466 yield Promise.all(versions.map((v) => __awaiter(this, void 0, void 0, function* () {
462467 const ociRepo = `${sourceInfo.owner}/${sourceInfo.repo}/${featureName}:${v}`;
@@ -543,7 +548,7 @@ function getFeaturesAndPackage(basePath, opts) {
543548 core.setFailed('Could not determine repository owner.');
544549 return;
545550 }
546- const archiveName = `${f}.tgz`;
551+ const archiveName = `devcontainer-feature- ${f}.tgz`;
547552 // ---- PUBLISH RELEASE ARTIFACTS (classic method) ----
548553 if (shouldPublishReleaseArtifacts || shouldPublishToOCI) {
549554 core.info(`** Tar'ing feature`);
0 commit comments