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
4ecc275a
Unverified
Commit
4ecc275a
authored
Aug 17, 2022
by
Josh Spicer
Committed by
GitHub
Aug 17, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update action to a82f06a29168a3c6594fb7206dd0afd3af8efdf2
parent
ef87daf5
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
4896 additions
and
11704 deletions
+4896
-11704
action.yml
.github/devcontainers-action/action.yml
+1
-31
index.js
.github/devcontainers-action/dist/index.js
+4780
-11191
index.js.map
.github/devcontainers-action/dist/index.js.map
+1
-1
licenses.txt
.github/devcontainers-action/dist/licenses.txt
+37
-150
generateDocs.js
.github/devcontainers-action/lib/generateDocs.js
+9
-4
main.js
.github/devcontainers-action/lib/main.js
+27
-55
utils.js
.github/devcontainers-action/lib/utils.js
+39
-261
release.yaml
.github/workflows/release.yaml
+2
-11
No files found.
.github/devcontainers-action/action.yml
View file @
4ecc275a
name
:
'
Dev
Container'
name
:
'
Dev
Container'
description
:
'
Publish
custom
development
container
feature(s)
and/or
templates(s)
'
description
:
'
Publish
custom
development
container
assets
'
author
:
'
GitHub'
author
:
'
GitHub'
branding
:
branding
:
icon
:
box
icon
:
box
...
@@ -10,10 +10,6 @@ inputs:
...
@@ -10,10 +10,6 @@ inputs:
required
:
false
required
:
false
default
:
"
false"
default
:
"
false"
description
:
"
['true'/'false']
Publish
dev
container
'feature'
artifacts"
description
:
"
['true'/'false']
Publish
dev
container
'feature'
artifacts"
publish-templates
:
required
:
false
default
:
"
false"
description
:
"
['true'/'false']
Publish
dev
container
'template'
artifacts"
generate-docs
:
generate-docs
:
required
:
false
required
:
false
default
:
"
false"
default
:
"
false"
...
@@ -26,37 +22,11 @@ inputs:
...
@@ -26,37 +22,11 @@ inputs:
description
:
"
Relative
path
to
the
'src'
folder
containing
dev
container
'feature(s)'"
description
:
"
Relative
path
to
the
'src'
folder
containing
dev
container
'feature(s)'"
oci-registry
:
oci-registry
:
required
:
false
required
:
false
default
:
"
ghcr.io"
description
:
"
Name
of
the
OCI
registry
that
implements
the
OCI
Artifact
Distribution
Specification"
description
:
"
Name
of
the
OCI
registry
that
implements
the
OCI
Artifact
Distribution
Specification"
features-namespace
:
features-namespace
:
required
:
false
required
:
false
default
:
"
<owner>/<repo>"
description
:
"
A
unique
indentifier
for
the
collection
of
features"
description
:
"
A
unique
indentifier
for
the
collection
of
features"
# 'template' options
base-path-to-templates
:
required
:
false
default
:
'
'
description
:
"
Relative
path
to
the
folder
containing
dev
container
'template(s)'"
# EXPERIMENTAL
tag-individual-features
:
required
:
false
default
:
"
false"
description
:
"
Tag
individual
features"
publish-to-npm
:
required
:
false
default
:
"
false"
description
:
"
Should
publish
features
to
NPM?"
publish-release-artifacts
:
required
:
false
default
:
"
false"
description
:
"
Publish
release
artifacts
(classic)"
publish-to-oci
:
required
:
false
default
:
"
false"
description
:
"
Publish
to
OCI?"
runs
:
runs
:
using
:
'
node16'
using
:
'
node16'
main
:
'
dist/index.js'
main
:
'
dist/index.js'
.github/devcontainers-action/dist/index.js
View file @
4ecc275a
This diff is collapsed.
Click to expand it.
.github/devcontainers-action/dist/index.js.map
View file @
4ecc275a
This diff is collapsed.
Click to expand it.
.github/devcontainers-action/dist/licenses.txt
View file @
4ecc275a
This diff is collapsed.
Click to expand it.
.github/devcontainers-action/lib/generateDocs.js
View file @
4ecc275a
...
@@ -56,9 +56,11 @@ const FEATURES_README_TEMPLATE = `
...
@@ -56,9 +56,11 @@ const FEATURES_README_TEMPLATE = `
#{OptionsTable}
#{OptionsTable}
#{Notes}
---
---
_Note: This file was auto-generated from the [devcontainer-feature.json](#{RepoUrl})._
_Note: This file was auto-generated from the [devcontainer-feature.json](#{RepoUrl}).
Add additional notes to a \`NOTES.md\`.
_
`
;
`
;
const
TEMPLATE_README_TEMPLATE
=
`
const
TEMPLATE_README_TEMPLATE
=
`
# #{Name}
# #{Name}
...
@@ -107,8 +109,6 @@ function _generateDocumentation(basePath, readmeTemplate, metadataFile, ociRegis
...
@@ -107,8 +109,6 @@ function _generateDocumentation(basePath, readmeTemplate, metadataFile, ociRegis
return
;
return
;
}
}
const
srcInfo
=
(
0
,
utils_1
.
getGitHubMetadata
)();
const
srcInfo
=
(
0
,
utils_1
.
getGitHubMetadata
)();
const
owner
=
srcInfo
.
owner
;
const
repo
=
srcInfo
.
repo
;
// Add version
// Add version
let
version
=
'latest'
;
let
version
=
'latest'
;
const
parsedVersion
=
parsedJson
===
null
||
parsedJson
===
void
0
?
void
0
:
parsedJson
.
version
;
const
parsedVersion
=
parsedJson
===
null
||
parsedJson
===
void
0
?
void
0
:
parsedJson
.
version
;
...
@@ -131,6 +131,10 @@ function _generateDocumentation(basePath, readmeTemplate, metadataFile, ociRegis
...
@@ -131,6 +131,10 @@ function _generateDocumentation(basePath, readmeTemplate, metadataFile, ociRegis
.
join
(
'
\
n'
);
.
join
(
'
\
n'
);
return
'| Options Id | Description | Type | Default Value |
\
n'
+
'|-----|-----|-----|-----|
\
n'
+
contents
;
return
'| Options Id | Description | Type | Default Value |
\
n'
+
'|-----|-----|-----|-----|
\
n'
+
contents
;
};
};
const
generateNotesMarkdown
=
()
=>
{
const
notesPath
=
path
.
join
(
basePath
,
f
,
'NOTES.md'
);
return
fs
.
existsSync
(
notesPath
)
?
fs
.
readFileSync
(
path
.
join
(
notesPath
),
'utf8'
)
:
''
;
};
let
urlToConfig
=
'./devcontainer-feature.json'
;
let
urlToConfig
=
'./devcontainer-feature.json'
;
const
basePathTrimmed
=
basePath
.
startsWith
(
'./'
)
?
basePath
.
substring
(
2
)
:
basePath
;
const
basePathTrimmed
=
basePath
.
startsWith
(
'./'
)
?
basePath
.
substring
(
2
)
:
basePath
;
if
(
srcInfo
.
owner
&&
srcInfo
.
repo
)
{
if
(
srcInfo
.
owner
&&
srcInfo
.
repo
)
{
...
@@ -142,9 +146,10 @@ function _generateDocumentation(basePath, readmeTemplate, metadataFile, ociRegis
...
@@ -142,9 +146,10 @@ function _generateDocumentation(basePath, readmeTemplate, metadataFile, ociRegis
.
replace
(
'#{Name}'
,
parsedJson
.
name
?
`
${
parsedJson
.
name
}
(
${
parsedJson
.
id
}
)`
:
`
${
parsedJson
.
id
}
`
)
.
replace
(
'#{Name}'
,
parsedJson
.
name
?
`
${
parsedJson
.
name
}
(
${
parsedJson
.
id
}
)`
:
`
${
parsedJson
.
id
}
`
)
.
replace
(
'#{Description}'
,
(
_a
=
parsedJson
.
description
)
!==
null
&&
_a
!==
void
0
?
_a
:
''
)
.
replace
(
'#{Description}'
,
(
_a
=
parsedJson
.
description
)
!==
null
&&
_a
!==
void
0
?
_a
:
''
)
.
replace
(
'#{OptionsTable}'
,
generateOptionsMarkdown
())
.
replace
(
'#{OptionsTable}'
,
generateOptionsMarkdown
())
.
replace
(
'#{Notes}'
,
generateNotesMarkdown
())
// Features Only
// Features Only
.
replace
(
'#{Registry}'
,
ociRegistry
)
.
replace
(
'#{Registry}'
,
ociRegistry
)
.
replace
(
'#{Namespace}'
,
namespace
==
'<owner>/<repo>'
?
`
${
owner
}
/
${
repo
}
`
:
namespace
)
.
replace
(
'#{Namespace}'
,
namespace
)
.
replace
(
'#{Version}'
,
version
)
.
replace
(
'#{Version}'
,
version
)
// Templates Only
// Templates Only
.
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
:
''
)
.
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
:
''
)
...
...
.github/devcontainers-action/lib/main.js
View file @
4ecc275a
...
@@ -39,83 +39,55 @@ Object.defineProperty(exports, "__esModule", { value: true });
...
@@ -39,83 +39,55 @@ Object.defineProperty(exports, "__esModule", { value: true });
const
core
=
__importStar
(
require
(
"@actions/core"
));
const
core
=
__importStar
(
require
(
"@actions/core"
));
const
generateDocs_1
=
require
(
"./generateDocs"
);
const
generateDocs_1
=
require
(
"./generateDocs"
);
const
utils_1
=
require
(
"./utils"
);
const
utils_1
=
require
(
"./utils"
);
const
exec
=
__importStar
(
require
(
"@actions/exec"
));
function
run
()
{
function
run
()
{
return
__awaiter
(
this
,
void
0
,
void
0
,
function
*
()
{
return
__awaiter
(
this
,
void
0
,
void
0
,
function
*
()
{
core
.
debug
(
'Reading input parameters...'
);
core
.
debug
(
'Reading input parameters...'
);
// Read inputs
// Read inputs
const
shouldPublishFeatures
=
core
.
getInput
(
'publish-features'
).
toLowerCase
()
===
'true'
;
const
shouldPublishFeatures
=
core
.
getInput
(
'publish-features'
).
toLowerCase
()
===
'true'
;
const
shouldPublishTemplates
=
core
.
getInput
(
'publish-templates'
).
toLowerCase
()
===
'true'
;
const
shouldGenerateDocumentation
=
core
.
getInput
(
'generate-docs'
).
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
featuresBasePath
=
core
.
getInput
(
'base-path-to-features'
);
const
templatesBasePath
=
core
.
getInput
(
'base-path-to-templates'
);
const
sourceMetadata
=
(
0
,
utils_1
.
getGitHubMetadata
)();
const
ociRegistry
=
core
.
getInput
(
'oci-registry'
);
const
inputOciRegistry
=
core
.
getInput
(
'oci-registry'
);
const
namespace
=
core
.
getInput
(
'features-namespace'
);
const
ociRegistry
=
inputOciRegistry
&&
inputOciRegistry
!==
''
?
inputOciRegistry
:
'ghcr.io'
;
let
featuresMetadata
=
undefined
;
const
inputNamespace
=
core
.
getInput
(
'namespace'
);
let
templatesMetadata
=
undefined
;
const
namespace
=
inputNamespace
&&
inputNamespace
!==
''
?
inputNamespace
:
`
${
sourceMetadata
.
owner
}
/
${
sourceMetadata
.
repo
}
`
;
// -- Package Release Artifacts
const
cliDebugMode
=
core
.
getInput
(
'devcontainer-cli-debug-mode'
).
toLowerCase
()
===
'true'
;
// -- Publish
if
(
shouldPublishFeatures
)
{
if
(
shouldPublishFeatures
)
{
core
.
info
(
'Publishing features...'
);
core
.
info
(
'Publishing features...'
);
featuresMetadata
=
yield
packageFeatures
(
featuresBasePath
,
opts
);
yield
publishFeatures
(
featuresBasePath
,
ociRegistry
,
namespace
,
cliDebugMode
);
}
if
(
shouldPublishTemplates
)
{
core
.
info
(
'Publishing template...'
);
templatesMetadata
=
yield
packageTemplates
(
templatesBasePath
);
}
}
// -- Generate Documentation
// -- Generate Documentation
if
(
shouldGenerateDocumentation
&&
featuresBasePath
)
{
if
(
shouldGenerateDocumentation
&&
featuresBasePath
)
{
core
.
info
(
'Generating documentation for features...'
);
core
.
info
(
'Generating documentation for features...'
);
yield
(
0
,
generateDocs_1
.
generateFeaturesDocumentation
)(
featuresBasePath
,
ociRegistry
,
namespace
);
yield
(
0
,
generateDocs_1
.
generateFeaturesDocumentation
)(
featuresBasePath
,
ociRegistry
,
namespace
);
}
}
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
p
ackageFeatures
(
basePath
,
opts
)
{
function
p
ublishFeatures
(
basePath
,
ociRegistry
,
namespace
,
cliDebugMode
=
false
)
{
return
__awaiter
(
this
,
void
0
,
void
0
,
function
*
()
{
return
__awaiter
(
this
,
void
0
,
void
0
,
function
*
()
{
try
{
// Ensures we have the devcontainer CLI installed.
core
.
info
(
`Archiving all features in
${
basePath
}
`
);
if
(
!
(
yield
(
0
,
utils_1
.
ensureDevcontainerCliPresent
)(
cliDebugMode
)))
{
const
metadata
=
yield
(
0
,
utils_1
.
getFeaturesAndPackage
)(
basePath
,
opts
);
core
.
setFailed
(
'Failed to install devcontainer CLI'
);
core
.
info
(
'Packaging features has finished.'
);
return
false
;
return
metadata
;
}
catch
(
error
)
{
if
(
error
instanceof
Error
)
{
core
.
setFailed
(
error
.
message
);
}
}
}
return
;
});
}
function
packageTemplates
(
basePath
)
{
return
__awaiter
(
this
,
void
0
,
void
0
,
function
*
()
{
try
{
try
{
core
.
info
(
`Archiving all templates in
${
basePath
}
`
);
let
cmd
=
'devcontainer'
;
const
metadata
=
yield
(
0
,
utils_1
.
getTemplatesAndPackage
)(
basePath
);
let
args
=
[
'features'
,
'publish'
,
'-r'
,
ociRegistry
,
'-n'
,
namespace
,
basePath
];
core
.
info
(
'Packaging templates has finished.'
);
if
(
cliDebugMode
)
{
return
metadata
;
cmd
=
'npx'
;
args
=
[
'-y'
,
'./devcontainer.tgz'
,
...
args
];
}
}
catch
(
error
)
{
const
res
=
yield
exec
.
getExecOutput
(
cmd
,
args
,
{
if
(
error
instanceof
Error
)
{
ignoreReturnCode
:
true
core
.
setFailed
(
error
.
message
);
});
return
res
.
exitCode
===
0
;
}
}
catch
(
err
)
{
core
.
setFailed
(
err
===
null
||
err
===
void
0
?
void
0
:
err
.
message
);
return
false
;
}
}
return
;
});
});
}
}
run
();
run
();
.github/devcontainers-action/lib/utils.js
View file @
4ecc275a
This diff is collapsed.
Click to expand it.
.github/workflows/release.yaml
View file @
4ecc275a
...
@@ -9,19 +9,10 @@ jobs:
...
@@ -9,19 +9,10 @@ jobs:
steps
:
steps
:
-
uses
:
actions/checkout@v2
-
uses
:
actions/checkout@v2
-
name
:
Install Oras
run
:
|
curl -LO https://github.com/oras-project/oras/releases/download/v0.13.0/oras_0.13.0_linux_amd64.tar.gz
mkdir -p oras-install/
tar -zxf oras_0.13.0_*.tar.gz -C oras-install/
mv oras-install/oras /usr/local/bin/
rm -rf oras_0.13.0_*.tar.gz oras-install/
-
name
:
"
Publish
features
to
OCI"
-
name
:
"
Publish
features
to
OCI"
uses
:
./.github/devcontainers-action
# TODO: Once 'devcontainers/action' is published, use that.
uses
:
./.github/devcontainers-action
# TODO: Once 'devcontainers/action' is published, use that.
with
:
with
:
publish-features
:
"
true"
publish-features
:
"
true"
publish-to-oci
:
"
true"
base-path-to-features
:
"
./src"
base-path-to-features
:
"
./src"
env
:
env
:
GITHUB_TOKEN
:
${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN
:
${{ secrets.GITHUB_TOKEN }}
\ No newline at end of file
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