@form8ion/github-workflows-core
v5.4.0
Published
core functionality for form8ion plugins that manage github workflows
Downloads
13,467
Readme
github-workflows-core
core functionality for form8ion plugins that manage github workflows
Table of Contents
Usage
Installation
$ npm install @form8ion/github-workflows-core --save-prod
Example
Import
import {
scaffoldCheckoutStep,
scaffoldNodeSetupStep,
scaffoldDependencyInstallationStep,
scaffoldVerificationStep,
loadWorkflowFile,
writeWorkflowFile,
workflowFileExists,
renameWorkflowFile
} from '@form8ion/github-workflows-core';
Execute
const projectRoot = process.cwd();
(async () => {
scaffoldCheckoutStep();
scaffoldNodeSetupStep({versionDeterminedBy: 'nvmrc'});
scaffoldDependencyInstallationStep();
scaffoldVerificationStep();
if (await workflowFileExists({projectRoot, name: 'existing-workflow-name'})) {
await loadWorkflowFile({projectRoot, name: 'existing-workflow-name'});
}
await writeWorkflowFile({projectRoot, name: 'workflow-name', config: {}});
await renameWorkflowFile({projectRoot, oldName: 'existing-workflow-name', newName: 'new-workflow-name'});
})();
API
scaffoldCheckoutStep
Scaffolder to define the details for a step to check out the project in a GitHub workflow
scaffoldNodeSetupStep
Scaffolder to define the details for a step to set up a node.js environment in a GitHub workflow
Takes a single options object as an argument, containing:
versionDeterminedBy
string (required)
Source of node version for use in the configured step. Valid options are nvmrc
or matrix
scaffoldDependencyInstallationStep
Scaffolder to define the details for a step to install dependencies in a GitHub workflow
scaffoldVerificationStep
Scaffolder to define the details for a step to execute verification
Contributing
Dependencies
$ nvm install
$ npm install
Verification
$ npm test