chore: change default branch from master to main (#396)

This commit is contained in:
Shohei Ueda 2020-07-14 12:45:04 +09:00 committed by GitHub
parent c935046a93
commit 932df18147
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 19 deletions

View File

@ -3,7 +3,7 @@ name: "Code Scanning"
on:
push:
branches:
- master
- main
pull_request:
jobs:

View File

@ -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'

View File

@ -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 }}

View File

@ -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)"