Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
chore: change default branch from master to main (#396)
  • Loading branch information
Shohei Ueda authored and GitHub committed Jul 14, 2020
1 parent c935046 commit 932df18
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Expand Up @@ -3,7 +3,7 @@ name: "Code Scanning"
on:
push:
branches:
- master
- main
pull_request:

jobs:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/dev-image.yml
Expand Up @@ -3,7 +3,7 @@ name: 'Dev Image CI'
on:
push:
branches:
- master
- main
paths:
- '.github/workflows/dev-image.yml'
- '.dockerignore'
Expand Down Expand Up @@ -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'
18 changes: 9 additions & 9 deletions .github/workflows/test.yml
Expand Up @@ -3,7 +3,7 @@ name: 'Test'
on:
push:
branches:
- master
- main
paths-ignore:
- '*.md'
pull_request:
Expand Down Expand Up @@ -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 }}
Expand All @@ -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 }}
Expand All @@ -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 }}
Expand All @@ -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 }}
Expand All @@ -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 }}
Expand Down
16 changes: 9 additions & 7 deletions release.sh
Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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
Expand All @@ -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)"
Expand Down

0 comments on commit 932df18

Please sign in to comment.