Browse Source

chore: rename develop branch to main (#4026)

pull/4034/head
Marcos Cáceres 6 months ago committed by GitHub
parent
commit
471d6f5b20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      .github/workflows/changelog.yml
  2. 4
      .github/workflows/codeql-analysis.yml
  3. 3
      .github/workflows/push.yml
  4. 25
      tools/release.js

2
.github/workflows/changelog.yml

@ -12,7 +12,7 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
ref: develop
ref: main
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6

4
.github/workflows/codeql-analysis.yml

@ -13,10 +13,10 @@ name: "CodeQL"
on:
push:
branches: [ develop ]
branches: [ main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ develop ]
branches: [ main ]
schedule:
- cron: '28 18 * * 4'

3
.github/workflows/push.yml

@ -2,8 +2,7 @@ name: Node CI (push)
on:
push:
branches:
- develop
- gh-pages
- main
paths-ignore:
- "**"
- "!**.js"

25
tools/release.js

@ -5,7 +5,6 @@ const cmdPrompt = require("prompt");
const colors = require("colors");
const { exec } = require("child_process");
const loading = require("loading-indicator");
const MAIN_BRANCH = "develop";
const DEBUG = false;
const vnu = require("vnu-jar");
const path = require("path");
@ -109,7 +108,7 @@ const Prompts = {
await this.askQuestion(promptOps);
} catch (err) {
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);
throw err;
@ -333,23 +332,23 @@ const indicators = new Map([
const run = async () => {
const initialBranch = await getCurrentBranch();
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();
await git("remote update");
indicators.get("remote-update").hide();
if (initialBranch !== MAIN_BRANCH) {
await Prompts.askSwitchToBranch(initialBranch, MAIN_BRANCH);
if (initialBranch !== "main") {
await Prompts.askSwitchToBranch(initialBranch, "main");
}
const branchState = await getBranchState();
switch (branchState) {
case "needs a pull":
await Prompts.askToPullBranch(MAIN_BRANCH);
await Prompts.askToPullBranch("main");
break;
case "up-to-date":
break;
case "needs to push":
throw new Error(
`Found unpushed commits on "${MAIN_BRANCH}" branch! Can't proceed.`
`Found unpushed commits on "main" branch! Can't proceed.`
);
default:
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(`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("pull origin gh-pages");
await git("merge develop");
await git("checkout develop");
await git("merge main");
await git("checkout main");
await Prompts.askPushAll();
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 --tags");
indicators.get("push-to-server").hide();
console.log(colors.green(" Publishing to npm... 📡"));
await npm("publish", { showOutput: true });
if (initialBranch !== MAIN_BRANCH) {
await Prompts.askSwitchToBranch(MAIN_BRANCH, initialBranch);
if (initialBranch !== "main") {
await Prompts.askSwitchToBranch("main", initialBranch);
}
} catch (err) {
console.error(colors.red(`\n${err.stack}`));

Loading…
Cancel
Save