Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(setup): add github actions as CI option #502

Merged
merged 23 commits into from
Dec 20, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/shipjs/src/flow/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ async function setup({ help = false, dir = '.', dryRun = false }) {
packagesToPublish,
isScoped,
isPublic,
CIIndex,
CIConfig,
ciIntegration,
ciConfig,
} = await askQuestions({ dir });
jeetiss marked this conversation as resolved.
Show resolved Hide resolved
const outputs = [
addDevDependencies({ dependencies: ['shipjs'], dir, dryRun }),
Expand All @@ -43,8 +43,8 @@ async function setup({ help = false, dir = '.', dryRun = false }) {
dir,
dryRun,
}),
integrations[CIIndex].addConfig({
...CIConfig,
integrations[ciIntegration].addConfig({
...ciConfig,
isScoped,
isPublic,
baseBranch,
Expand Down
7 changes: 6 additions & 1 deletion packages/shipjs/src/step/setup/CI/addGithubActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,12 @@ name: Ship js Manual Prepare
);
}

function getScheduleConfig({ baseBranch, cronExpr, gitUserName, gitUserEmail }) {
function getScheduleConfig({
baseBranch,
cronExpr,
gitUserName,
gitUserEmail,
}) {
return ejs.render(
`
name: Ship js Schedule Prepare
Expand Down
2 changes: 1 addition & 1 deletion packages/shipjs/src/step/setup/CI/askGithubActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ export default async function askGithubActions() {
return {
manualPrepare,
schedulePrepare,
cronExpr
cronExpr,
};
}
6 changes: 3 additions & 3 deletions packages/shipjs/src/step/setup/CI/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ const noop = () => ({});
export default [
{
name: 'Circle CI',
askQustions: askCircleCI,
askQuestions: askCircleCI,
addConfig: addCircleCIConfig,
},
{
name: 'Github Actions',
askQustions: askGithubActions,
askQuestions: askGithubActions,
addConfig: addGithubActions,
},
{
name: 'Nothing',
askQustions: noop,
askQuestions: noop,
addConfig: noop,
},
];
16 changes: 8 additions & 8 deletions packages/shipjs/src/step/setup/askQuestions.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import runStep from '../runStep';
export default async ({ dir }) =>
await runStep({}, async () => {
const { baseBranch, releaseBranch } = await askBranches(dir);
const { CIIndex, CIConfig } = await askCI(dir);
const { ciIntegration, ciConfig } = await askCI(dir);
const {
useMonorepo,
mainVersionFile,
Expand All @@ -22,8 +22,8 @@ export default async ({ dir }) =>
return {
baseBranch,
releaseBranch,
CIIndex,
CIConfig,
ciIntegration,
ciConfig,
useMonorepo,
mainVersionFile,
packagesToBump,
Expand Down Expand Up @@ -73,19 +73,19 @@ async function askBranches(dir) {

async function askCI() {
const choices = integrations.map(config => config.name);
const { CITypeText } = await inquirer.prompt([
const { ciTypeText } = await inquirer.prompt([
{
type: 'list',
name: 'CITypeText',
name: 'ciTypeText',
message: 'Which CI configure?',
choices,
},
]);

const CIIndex = choices.indexOf(CITypeText);
const CIConfig = await integrations[CIIndex].askQustions();
const ciIntegration = choices.indexOf(ciTypeText);
const ciConfig = await integrations[ciIntegration].askQuestions();
jeetiss marked this conversation as resolved.
Show resolved Hide resolved

return { CIIndex, CIConfig };
return { ciIntegration, ciConfig };
}

async function askMonorepo(dir) {
Expand Down