From 932df18147b59ce4a998b4caabfcc50f1889c827 Mon Sep 17 00:00:00 2001 From: Shohei Ueda <30958501+peaceiris@users.noreply.github.com> Date: Tue, 14 Jul 2020 12:45:04 +0900 Subject: [PATCH] chore: change default branch from master to main (#396) --- .github/workflows/codeql.yml | 2 +- .github/workflows/dev-image.yml | 4 ++-- .github/workflows/test.yml | 18 +++++++++--------- release.sh | 16 +++++++++------- 4 files changed, 21 insertions(+), 19 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 18b583a..348f329 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -3,7 +3,7 @@ name: "Code Scanning" on: push: branches: - - master + - main pull_request: jobs: diff --git a/.github/workflows/dev-image.yml b/.github/workflows/dev-image.yml index 27bfd7b..8578138 100644 --- a/.github/workflows/dev-image.yml +++ b/.github/workflows/dev-image.yml @@ -3,7 +3,7 @@ name: 'Dev Image CI' on: push: branches: - - master + - main paths: - '.github/workflows/dev-image.yml' - '.dockerignore' @@ -40,4 +40,4 @@ jobs: - run: make cirun cmd="npm ci" - run: make ciall - run: make push - if: github.ref == 'refs/heads/master' + if: github.ref == 'refs/heads/main' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2384b66..e8b4aba 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,7 +3,7 @@ name: 'Test' on: push: branches: - - master + - main paths-ignore: - '*.md' pull_request: @@ -72,26 +72,26 @@ jobs: run: npm run build - name: Remove lint-staged husky - if: github.ref == 'refs/heads/master' + if: github.ref == 'refs/heads/main' run: | npm uninstall lint-staged husky git checkout package-lock.json package.json - name: Setup mdBook - if: github.ref == 'refs/heads/master' + if: github.ref == 'refs/heads/main' uses: peaceiris/actions-mdbook@v1.1.12 with: mdbook-version: '0.3.7' - name: Build site - if: github.ref == 'refs/heads/master' + if: github.ref == 'refs/heads/main' working-directory: ./test_projects/mdbook run: mdbook build - name: Deploy if: | startsWith(matrix.os, 'ubuntu-18.04') && - github.ref == 'refs/heads/master' + github.ref == 'refs/heads/main' uses: ./ with: # deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} @@ -110,7 +110,7 @@ jobs: - name: Deploy if: | startsWith(matrix.os, 'ubuntu-16.04') && - github.ref == 'refs/heads/master' + github.ref == 'refs/heads/main' uses: ./ with: deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} @@ -128,7 +128,7 @@ jobs: - name: Deploy if: | startsWith(matrix.os, 'macos') && - github.ref == 'refs/heads/master' + github.ref == 'refs/heads/main' uses: ./ with: deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} @@ -147,7 +147,7 @@ jobs: - name: Deploy if: | startsWith(matrix.os, 'windows') && - github.ref == 'refs/heads/master' + github.ref == 'refs/heads/main' uses: ./ with: # deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} @@ -166,7 +166,7 @@ jobs: - name: Deploy if: | startsWith(matrix.os, 'ubuntu-20.04') && - github.ref == 'refs/heads/master' + github.ref == 'refs/heads/main' uses: ./ with: # deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} diff --git a/release.sh b/release.sh index 0132d41..0bf9054 100755 --- a/release.sh +++ b/release.sh @@ -3,9 +3,11 @@ # fail on unset variables and command errors set -eu -o pipefail # -x: is for debugging +DEFAULT_BRANCH="main" + CURRENT_BRANCH="$(git branch --show-current)" -if [ "${CURRENT_BRANCH}" != "master" ]; then - echo "$0: Current branch ${CURRENT_BRANCH} is not master, continue? (y/n)" +if [ "${CURRENT_BRANCH}" != "${DEFAULT_BRANCH}" ]; then + echo "$0: Current branch ${CURRENT_BRANCH} is not ${DEFAULT_BRANCH}, continue? (y/n)" read -r res if [ "${res}" = "n" ]; then echo "$0: Stop script" @@ -14,7 +16,7 @@ if [ "${CURRENT_BRANCH}" != "master" ]; then fi PRERELEASE_TYPE_LIST="prerelease prepatch preminor premajor" -if [ "${CURRENT_BRANCH}" != "master" ]; then +if [ "${CURRENT_BRANCH}" != "${DEFAULT_BRANCH}" ]; then RELEASE_TYPE_LIST="${PRERELEASE_TYPE_LIST}" else RELEASE_TYPE_LIST="${PRERELEASE_TYPE_LIST} patch minor major" @@ -37,10 +39,10 @@ if [ "${res}" = "n" ]; then fi git fetch origin -if [ "${CURRENT_BRANCH}" != "master" ]; then +if [ "${CURRENT_BRANCH}" != "${DEFAULT_BRANCH}" ]; then git pull origin "${CURRENT_BRANCH}" else - git pull origin master + git pull origin ${DEFAULT_BRANCH} git tag -d v3 || true git pull origin --tags fi @@ -58,10 +60,10 @@ git rm ./lib/index.js rm -rf ./lib git commit -m "chore(release): Remove build assets [skip ci]" -if [ "${CURRENT_BRANCH}" != "master" ]; then +if [ "${CURRENT_BRANCH}" != "${DEFAULT_BRANCH}" ]; then git push origin "${CURRENT_BRANCH}" else - git push origin master + git push origin ${DEFAULT_BRANCH} fi TAG_NAME="v$(jq -r '.version' ./package.json)"