Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
devcontainer-features
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
eazydevelop-devcontainer-temp
devcontainer-features
Commits
43fd91f7
Commit
43fd91f7
authored
Jun 22, 2022
by
Josh Spicer
Committed by
GitHub
Jun 22, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no-ci - update action (generate features collection artifact)
parent
6f107d54
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
21 deletions
+49
-21
index.js
.github/devcontainers-action/dist/index.js
+24
-10
index.js.map
.github/devcontainers-action/dist/index.js.map
+1
-1
main.js
.github/devcontainers-action/lib/main.js
+10
-4
utils.js
.github/devcontainers-action/lib/utils.js
+14
-6
No files found.
.github/devcontainers-action/dist/index.js
View file @
43fd91f7
...
@@ -197,14 +197,17 @@ function run() {
...
@@ -197,14 +197,17 @@ function run() {
const
shouldPublishFeatures
=
core
.
getInput
(
'publish-features'
).
toLowerCase
()
===
'true'
;
const
shouldPublishFeatures
=
core
.
getInput
(
'publish-features'
).
toLowerCase
()
===
'true'
;
const
shouldPublishTemplate
=
core
.
getInput
(
'publish-templates'
).
toLowerCase
()
===
'true'
;
const
shouldPublishTemplate
=
core
.
getInput
(
'publish-templates'
).
toLowerCase
()
===
'true'
;
const
shouldGenerateDocumentation
=
core
.
getInput
(
'generate-docs'
).
toLowerCase
()
===
'true'
;
const
shouldGenerateDocumentation
=
core
.
getInput
(
'generate-docs'
).
toLowerCase
()
===
'true'
;
let
featuresMetadata
=
undefined
;
let
templatesMetadata
=
undefined
;
if
(
shouldPublishFeatures
)
{
if
(
shouldPublishFeatures
)
{
core
.
info
(
'Publishing features...'
);
core
.
info
(
'Publishing features...'
);
const
featuresBasePath
=
core
.
getInput
(
'base-path-to-features'
);
const
featuresBasePath
=
core
.
getInput
(
'base-path-to-features'
);
yield
packageFeatures
(
featuresBasePath
);
featuresMetadata
=
yield
packageFeatures
(
featuresBasePath
);
}
}
if
(
shouldPublishTemplate
)
{
if
(
shouldPublishTemplate
)
{
core
.
info
(
'Publishing template...'
);
core
.
info
(
'Publishing template...'
);
const
basePathToDefinitions
=
core
.
getInput
(
'base-path-to-templates'
);
const
basePathToDefinitions
=
core
.
getInput
(
'base-path-to-templates'
);
templatesMetadata
=
undefined
;
// TODO
yield
packageTemplates
(
basePathToDefinitions
);
yield
packageTemplates
(
basePathToDefinitions
);
}
}
if
(
shouldGenerateDocumentation
)
{
if
(
shouldGenerateDocumentation
)
{
...
@@ -220,20 +223,23 @@ function run() {
...
@@ -220,20 +223,23 @@ function run() {
}
}
// TODO: Programatically add feature/template fino with relevant metadata for UX clients.
// TODO: Programatically add feature/template fino with relevant metadata for UX clients.
core
.
info
(
'Generation metadata file: devcontainer-collection.json'
);
core
.
info
(
'Generation metadata file: devcontainer-collection.json'
);
yield
(
0
,
utils_1
.
addCollectionsMetadataFile
)();
yield
(
0
,
utils_1
.
addCollectionsMetadataFile
)(
featuresMetadata
,
templatesMetadata
);
});
});
}
}
function
packageFeatures
(
basePath
)
{
function
packageFeatures
(
basePath
)
{
return
__awaiter
(
this
,
void
0
,
void
0
,
function
*
()
{
return
__awaiter
(
this
,
void
0
,
void
0
,
function
*
()
{
try
{
try
{
core
.
info
(
`Archiving all features in
${
basePath
}
`
);
core
.
info
(
`Archiving all features in
${
basePath
}
`
);
yield
(
0
,
utils_1
.
getFeaturesAndPackage
)(
basePath
);
const
metadata
=
yield
(
0
,
utils_1
.
getFeaturesAndPackage
)(
basePath
);
core
.
info
(
'Packaging features has finished.'
);
core
.
info
(
'Packaging features has finished.'
);
return
metadata
;
}
}
catch
(
error
)
{
catch
(
error
)
{
if
(
error
instanceof
Error
)
if
(
error
instanceof
Error
)
{
core
.
setFailed
(
error
.
message
);
core
.
setFailed
(
error
.
message
);
}
}
}
return
;
});
});
}
}
function
packageTemplates
(
basePath
)
{
function
packageTemplates
(
basePath
)
{
...
@@ -323,7 +329,7 @@ function tarDirectory(path, tgzName) {
...
@@ -323,7 +329,7 @@ function tarDirectory(path, tgzName) {
});
});
}
}
exports
.
tarDirectory
=
tarDirectory
;
exports
.
tarDirectory
=
tarDirectory
;
function
addCollectionsMetadataFile
()
{
function
addCollectionsMetadataFile
(
featuresMetadata
,
templatesMetadata
)
{
return
__awaiter
(
this
,
void
0
,
void
0
,
function
*
()
{
return
__awaiter
(
this
,
void
0
,
void
0
,
function
*
()
{
const
p
=
path_1
.
default
.
join
(
'.'
,
'devcontainer-collection.json'
);
const
p
=
path_1
.
default
.
join
(
'.'
,
'devcontainer-collection.json'
);
// Insert github repo metadata
// Insert github repo metadata
...
@@ -342,8 +348,8 @@ function addCollectionsMetadataFile() {
...
@@ -342,8 +348,8 @@ function addCollectionsMetadataFile() {
}
}
const
metadata
=
{
const
metadata
=
{
sourceInformation
,
sourceInformation
,
features
:
[],
features
:
featuresMetadata
||
[],
templates
:
[]
templates
:
templatesMetadata
||
[]
};
};
// Write to the file
// Write to the file
yield
(
0
,
exports
.
writeLocalFile
)(
p
,
JSON
.
stringify
(
metadata
,
undefined
,
4
));
yield
(
0
,
exports
.
writeLocalFile
)(
p
,
JSON
.
stringify
(
metadata
,
undefined
,
4
));
...
@@ -352,7 +358,7 @@ function addCollectionsMetadataFile() {
...
@@ -352,7 +358,7 @@ function addCollectionsMetadataFile() {
exports
.
addCollectionsMetadataFile
=
addCollectionsMetadataFile
;
exports
.
addCollectionsMetadataFile
=
addCollectionsMetadataFile
;
function
getFeaturesAndPackage
(
basePath
)
{
function
getFeaturesAndPackage
(
basePath
)
{
return
__awaiter
(
this
,
void
0
,
void
0
,
function
*
()
{
return
__awaiter
(
this
,
void
0
,
void
0
,
function
*
()
{
let
archive
s
=
[];
let
metadata
s
=
[];
fs
.
readdir
(
basePath
,
(
err
,
files
)
=>
{
fs
.
readdir
(
basePath
,
(
err
,
files
)
=>
{
if
(
err
)
{
if
(
err
)
{
core
.
error
(
err
.
message
);
core
.
error
(
err
.
message
);
...
@@ -362,13 +368,21 @@ function getFeaturesAndPackage(basePath) {
...
@@ -362,13 +368,21 @@ function getFeaturesAndPackage(basePath) {
files
.
forEach
(
file
=>
{
files
.
forEach
(
file
=>
{
core
.
info
(
`feature ==>
${
file
}
`
);
core
.
info
(
`feature ==>
${
file
}
`
);
if
(
file
!==
'.'
&&
file
!==
'..'
)
{
if
(
file
!==
'.'
&&
file
!==
'..'
)
{
const
featureFolder
=
path_1
.
default
.
join
(
basePath
,
file
);
const
archiveName
=
`
${
file
}
.tgz`
;
const
archiveName
=
`
${
file
}
.tgz`
;
tarDirectory
(
`
${
basePath
}
/
${
file
}
`
,
archiveName
);
tarDirectory
(
`
${
basePath
}
/
${
file
}
`
,
archiveName
);
archives
.
push
(
archiveName
);
const
featureJsonPath
=
path_1
.
default
.
join
(
featureFolder
,
"devcontainer-feature.json"
);
if
(
!
fs
.
existsSync
(
featureJsonPath
))
{
core
.
error
(
`Feature
${
file
}
is missing a devcontainer-feature.json`
);
core
.
setFailed
(
'All features must have a devcontainer-feature.json'
);
return
;
}
const
featureMetadata
=
JSON
.
parse
(
fs
.
readFileSync
(
featureJsonPath
,
"utf8"
));
metadatas
.
push
(
featureMetadata
);
}
}
});
});
});
});
return
archive
s
;
return
metadata
s
;
});
});
}
}
exports
.
getFeaturesAndPackage
=
getFeaturesAndPackage
;
exports
.
getFeaturesAndPackage
=
getFeaturesAndPackage
;
...
...
.github/devcontainers-action/dist/index.js.map
View file @
43fd91f7
This diff is collapsed.
Click to expand it.
.github/devcontainers-action/lib/main.js
View file @
43fd91f7
...
@@ -46,14 +46,17 @@ function run() {
...
@@ -46,14 +46,17 @@ function run() {
const
shouldPublishFeatures
=
core
.
getInput
(
'publish-features'
).
toLowerCase
()
===
'true'
;
const
shouldPublishFeatures
=
core
.
getInput
(
'publish-features'
).
toLowerCase
()
===
'true'
;
const
shouldPublishTemplate
=
core
.
getInput
(
'publish-templates'
).
toLowerCase
()
===
'true'
;
const
shouldPublishTemplate
=
core
.
getInput
(
'publish-templates'
).
toLowerCase
()
===
'true'
;
const
shouldGenerateDocumentation
=
core
.
getInput
(
'generate-docs'
).
toLowerCase
()
===
'true'
;
const
shouldGenerateDocumentation
=
core
.
getInput
(
'generate-docs'
).
toLowerCase
()
===
'true'
;
let
featuresMetadata
=
undefined
;
let
templatesMetadata
=
undefined
;
if
(
shouldPublishFeatures
)
{
if
(
shouldPublishFeatures
)
{
core
.
info
(
'Publishing features...'
);
core
.
info
(
'Publishing features...'
);
const
featuresBasePath
=
core
.
getInput
(
'base-path-to-features'
);
const
featuresBasePath
=
core
.
getInput
(
'base-path-to-features'
);
yield
packageFeatures
(
featuresBasePath
);
featuresMetadata
=
yield
packageFeatures
(
featuresBasePath
);
}
}
if
(
shouldPublishTemplate
)
{
if
(
shouldPublishTemplate
)
{
core
.
info
(
'Publishing template...'
);
core
.
info
(
'Publishing template...'
);
const
basePathToDefinitions
=
core
.
getInput
(
'base-path-to-templates'
);
const
basePathToDefinitions
=
core
.
getInput
(
'base-path-to-templates'
);
templatesMetadata
=
undefined
;
// TODO
yield
packageTemplates
(
basePathToDefinitions
);
yield
packageTemplates
(
basePathToDefinitions
);
}
}
if
(
shouldGenerateDocumentation
)
{
if
(
shouldGenerateDocumentation
)
{
...
@@ -69,20 +72,23 @@ function run() {
...
@@ -69,20 +72,23 @@ function run() {
}
}
// TODO: Programatically add feature/template fino with relevant metadata for UX clients.
// TODO: Programatically add feature/template fino with relevant metadata for UX clients.
core
.
info
(
'Generation metadata file: devcontainer-collection.json'
);
core
.
info
(
'Generation metadata file: devcontainer-collection.json'
);
yield
(
0
,
utils_1
.
addCollectionsMetadataFile
)();
yield
(
0
,
utils_1
.
addCollectionsMetadataFile
)(
featuresMetadata
,
templatesMetadata
);
});
});
}
}
function
packageFeatures
(
basePath
)
{
function
packageFeatures
(
basePath
)
{
return
__awaiter
(
this
,
void
0
,
void
0
,
function
*
()
{
return
__awaiter
(
this
,
void
0
,
void
0
,
function
*
()
{
try
{
try
{
core
.
info
(
`Archiving all features in
${
basePath
}
`
);
core
.
info
(
`Archiving all features in
${
basePath
}
`
);
yield
(
0
,
utils_1
.
getFeaturesAndPackage
)(
basePath
);
const
metadata
=
yield
(
0
,
utils_1
.
getFeaturesAndPackage
)(
basePath
);
core
.
info
(
'Packaging features has finished.'
);
core
.
info
(
'Packaging features has finished.'
);
return
metadata
;
}
}
catch
(
error
)
{
catch
(
error
)
{
if
(
error
instanceof
Error
)
if
(
error
instanceof
Error
)
{
core
.
setFailed
(
error
.
message
);
core
.
setFailed
(
error
.
message
);
}
}
}
return
;
});
});
}
}
function
packageTemplates
(
basePath
)
{
function
packageTemplates
(
basePath
)
{
...
...
.github/devcontainers-action/lib/utils.js
View file @
43fd91f7
...
@@ -62,7 +62,7 @@ function tarDirectory(path, tgzName) {
...
@@ -62,7 +62,7 @@ function tarDirectory(path, tgzName) {
});
});
}
}
exports
.
tarDirectory
=
tarDirectory
;
exports
.
tarDirectory
=
tarDirectory
;
function
addCollectionsMetadataFile
()
{
function
addCollectionsMetadataFile
(
featuresMetadata
,
templatesMetadata
)
{
return
__awaiter
(
this
,
void
0
,
void
0
,
function
*
()
{
return
__awaiter
(
this
,
void
0
,
void
0
,
function
*
()
{
const
p
=
path_1
.
default
.
join
(
'.'
,
'devcontainer-collection.json'
);
const
p
=
path_1
.
default
.
join
(
'.'
,
'devcontainer-collection.json'
);
// Insert github repo metadata
// Insert github repo metadata
...
@@ -81,8 +81,8 @@ function addCollectionsMetadataFile() {
...
@@ -81,8 +81,8 @@ function addCollectionsMetadataFile() {
}
}
const
metadata
=
{
const
metadata
=
{
sourceInformation
,
sourceInformation
,
features
:
[],
features
:
featuresMetadata
||
[],
templates
:
[]
templates
:
templatesMetadata
||
[]
};
};
// Write to the file
// Write to the file
yield
(
0
,
exports
.
writeLocalFile
)(
p
,
JSON
.
stringify
(
metadata
,
undefined
,
4
));
yield
(
0
,
exports
.
writeLocalFile
)(
p
,
JSON
.
stringify
(
metadata
,
undefined
,
4
));
...
@@ -91,7 +91,7 @@ function addCollectionsMetadataFile() {
...
@@ -91,7 +91,7 @@ function addCollectionsMetadataFile() {
exports
.
addCollectionsMetadataFile
=
addCollectionsMetadataFile
;
exports
.
addCollectionsMetadataFile
=
addCollectionsMetadataFile
;
function
getFeaturesAndPackage
(
basePath
)
{
function
getFeaturesAndPackage
(
basePath
)
{
return
__awaiter
(
this
,
void
0
,
void
0
,
function
*
()
{
return
__awaiter
(
this
,
void
0
,
void
0
,
function
*
()
{
let
archive
s
=
[];
let
metadata
s
=
[];
fs
.
readdir
(
basePath
,
(
err
,
files
)
=>
{
fs
.
readdir
(
basePath
,
(
err
,
files
)
=>
{
if
(
err
)
{
if
(
err
)
{
core
.
error
(
err
.
message
);
core
.
error
(
err
.
message
);
...
@@ -101,13 +101,21 @@ function getFeaturesAndPackage(basePath) {
...
@@ -101,13 +101,21 @@ function getFeaturesAndPackage(basePath) {
files
.
forEach
(
file
=>
{
files
.
forEach
(
file
=>
{
core
.
info
(
`feature ==>
${
file
}
`
);
core
.
info
(
`feature ==>
${
file
}
`
);
if
(
file
!==
'.'
&&
file
!==
'..'
)
{
if
(
file
!==
'.'
&&
file
!==
'..'
)
{
const
featureFolder
=
path_1
.
default
.
join
(
basePath
,
file
);
const
archiveName
=
`
${
file
}
.tgz`
;
const
archiveName
=
`
${
file
}
.tgz`
;
tarDirectory
(
`
${
basePath
}
/
${
file
}
`
,
archiveName
);
tarDirectory
(
`
${
basePath
}
/
${
file
}
`
,
archiveName
);
archives
.
push
(
archiveName
);
const
featureJsonPath
=
path_1
.
default
.
join
(
featureFolder
,
"devcontainer-feature.json"
);
if
(
!
fs
.
existsSync
(
featureJsonPath
))
{
core
.
error
(
`Feature
${
file
}
is missing a devcontainer-feature.json`
);
core
.
setFailed
(
'All features must have a devcontainer-feature.json'
);
return
;
}
const
featureMetadata
=
JSON
.
parse
(
fs
.
readFileSync
(
featureJsonPath
,
"utf8"
));
metadatas
.
push
(
featureMetadata
);
}
}
});
});
});
});
return
archive
s
;
return
metadata
s
;
});
});
}
}
exports
.
getFeaturesAndPackage
=
getFeaturesAndPackage
;
exports
.
getFeaturesAndPackage
=
getFeaturesAndPackage
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment