chore: rename develop branch to main (#4026)
This commit is contained in:
parent
c337f4c009
commit
471d6f5b20
|
@ -12,7 +12,7 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
ref: develop
|
ref: main
|
||||||
- uses: ruby/setup-ruby@v1
|
- uses: ruby/setup-ruby@v1
|
||||||
with:
|
with:
|
||||||
ruby-version: 2.6
|
ruby-version: 2.6
|
||||||
|
|
|
@ -13,10 +13,10 @@ name: "CodeQL"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ develop ]
|
branches: [ main ]
|
||||||
pull_request:
|
pull_request:
|
||||||
# The branches below must be a subset of the branches above
|
# The branches below must be a subset of the branches above
|
||||||
branches: [ develop ]
|
branches: [ main ]
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '28 18 * * 4'
|
- cron: '28 18 * * 4'
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,7 @@ name: Node CI (push)
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- develop
|
- main
|
||||||
- gh-pages
|
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- "**"
|
- "**"
|
||||||
- "!**.js"
|
- "!**.js"
|
||||||
|
|
|
@ -5,7 +5,6 @@ const cmdPrompt = require("prompt");
|
||||||
const colors = require("colors");
|
const colors = require("colors");
|
||||||
const { exec } = require("child_process");
|
const { exec } = require("child_process");
|
||||||
const loading = require("loading-indicator");
|
const loading = require("loading-indicator");
|
||||||
const MAIN_BRANCH = "develop";
|
|
||||||
const DEBUG = false;
|
const DEBUG = false;
|
||||||
const vnu = require("vnu-jar");
|
const vnu = require("vnu-jar");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
@ -109,7 +108,7 @@ const Prompts = {
|
||||||
await this.askQuestion(promptOps);
|
await this.askQuestion(promptOps);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
const warning = colors.yellow(
|
const warning = colors.yellow(
|
||||||
"🚨 Make sure to run `git up; git checkout develop`"
|
"🚨 Make sure to run `git checkout main` and reset any changes."
|
||||||
);
|
);
|
||||||
console.warn(warning);
|
console.warn(warning);
|
||||||
throw err;
|
throw err;
|
||||||
|
@ -333,23 +332,23 @@ const indicators = new Map([
|
||||||
const run = async () => {
|
const run = async () => {
|
||||||
const initialBranch = await getCurrentBranch();
|
const initialBranch = await getCurrentBranch();
|
||||||
try {
|
try {
|
||||||
// 1. Confirm maintainer is on up-to-date and on the develop branch ()
|
// 1. Confirm maintainer is on up-to-date and on the main branch ()
|
||||||
indicators.get("remote-update").show();
|
indicators.get("remote-update").show();
|
||||||
await git("remote update");
|
await git("remote update");
|
||||||
indicators.get("remote-update").hide();
|
indicators.get("remote-update").hide();
|
||||||
if (initialBranch !== MAIN_BRANCH) {
|
if (initialBranch !== "main") {
|
||||||
await Prompts.askSwitchToBranch(initialBranch, MAIN_BRANCH);
|
await Prompts.askSwitchToBranch(initialBranch, "main");
|
||||||
}
|
}
|
||||||
const branchState = await getBranchState();
|
const branchState = await getBranchState();
|
||||||
switch (branchState) {
|
switch (branchState) {
|
||||||
case "needs a pull":
|
case "needs a pull":
|
||||||
await Prompts.askToPullBranch(MAIN_BRANCH);
|
await Prompts.askToPullBranch("main");
|
||||||
break;
|
break;
|
||||||
case "up-to-date":
|
case "up-to-date":
|
||||||
break;
|
break;
|
||||||
case "needs to push":
|
case "needs to push":
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Found unpushed commits on "${MAIN_BRANCH}" branch! Can't proceed.`
|
`Found unpushed commits on "main" branch! Can't proceed.`
|
||||||
);
|
);
|
||||||
default:
|
default:
|
||||||
throw new Error(`Your branch is not up-to-date. It ${branchState}.`);
|
throw new Error(`Your branch is not up-to-date. It ${branchState}.`);
|
||||||
|
@ -381,21 +380,21 @@ const run = async () => {
|
||||||
await git(`commit -m "v${version}"`);
|
await git(`commit -m "v${version}"`);
|
||||||
await git(`tag "v${version}"`);
|
await git(`tag "v${version}"`);
|
||||||
|
|
||||||
// 5. Merge to gh-pages (git checkout gh-pages; git merge develop)
|
// 5. Merge to gh-pages (git checkout gh-pages; git merge main)
|
||||||
await git("checkout gh-pages");
|
await git("checkout gh-pages");
|
||||||
await git("pull origin gh-pages");
|
await git("pull origin gh-pages");
|
||||||
await git("merge develop");
|
await git("merge main");
|
||||||
await git("checkout develop");
|
await git("checkout main");
|
||||||
await Prompts.askPushAll();
|
await Prompts.askPushAll();
|
||||||
indicators.get("push-to-server").show();
|
indicators.get("push-to-server").show();
|
||||||
await git("push origin develop");
|
await git("push origin main");
|
||||||
await git("push origin gh-pages");
|
await git("push origin gh-pages");
|
||||||
await git("push --tags");
|
await git("push --tags");
|
||||||
indicators.get("push-to-server").hide();
|
indicators.get("push-to-server").hide();
|
||||||
console.log(colors.green(" Publishing to npm... 📡"));
|
console.log(colors.green(" Publishing to npm... 📡"));
|
||||||
await npm("publish", { showOutput: true });
|
await npm("publish", { showOutput: true });
|
||||||
if (initialBranch !== MAIN_BRANCH) {
|
if (initialBranch !== "main") {
|
||||||
await Prompts.askSwitchToBranch(MAIN_BRANCH, initialBranch);
|
await Prompts.askSwitchToBranch("main", initialBranch);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(colors.red(`\n☠ ${err.stack}`));
|
console.error(colors.red(`\n☠ ${err.stack}`));
|
||||||
|
|
Loading…
Reference in New Issue