-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4c9b246
Showing
295 changed files
with
54,829 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Diploi Component Metadata Action | ||
|
||
An action that collects component metadata from a Diploi stack. | ||
|
||
[diploi.com](https://diploi.com/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: 'Diploi Component Metadata Action' | ||
description: 'An action that collects component metadata from a Diploi stack' | ||
branding: | ||
icon: 'package' | ||
color: 'purple' | ||
|
||
outputs: | ||
components: | ||
description: 'List of components (identifier, name, folder, stage, ref) that need to be built' | ||
|
||
runs: | ||
using: 'node20' | ||
main: 'index.js' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const yaml = require('js-yaml'); | ||
const core = require('@actions/core'); | ||
|
||
try { | ||
const config = yaml.load(fs.readFileSync('diploi.yaml', 'utf-8')); | ||
const componentsOutput = []; | ||
|
||
for (const component of config.components) { | ||
if (!fs.existsSync(component.identifier)) { | ||
throw new Error( | ||
`Folder /${component.identifier} for the ${component.identifier} component is missing.` | ||
); | ||
} | ||
|
||
const componentOutput = { | ||
identifier: component.identifier, | ||
name: component.name || component.identifier, | ||
folder: component.identifier, | ||
ref: component.package.split('#').pop(), | ||
}; | ||
|
||
componentsOutput.push(componentOutput); | ||
|
||
if (fs.existsSync(path.join(component.identifier, 'Dockerfile.dev'))) { | ||
componentsOutput.push({ | ||
...componentOutput, | ||
stage: 'dev', | ||
}); | ||
} | ||
} | ||
|
||
core.setOutput('components', JSON.stringify(componentsOutput)); | ||
} catch (error) { | ||
core.setFailed(error.message); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.