Skip to content

Commit

Permalink
Switch default branch from master to main
Browse files Browse the repository at this point in the history
merges #399
closes #349

Co-authored-by: Anthony Gitter <[email protected]>
  • Loading branch information
dhimmel and agitter committed Dec 11, 2020
1 parent 97b2948 commit 690aac1
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 22 deletions.
3 changes: 2 additions & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ skip_branch_with_pr: true
# to only build commits from pull requests
branches:
only:
- main
- master

# Only run AppVeyor on commits that modify at least one of the following files
# Delete these lines to run AppVeyor on all master branch commits
# Delete these lines to run AppVeyor on all main/master branch commits
only_commits:
files:
- .appveyor.yml
Expand Down
20 changes: 13 additions & 7 deletions .github/workflows/manubot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ name: Manubot
on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master
jobs:
manubot:
Expand All @@ -14,23 +16,27 @@ jobs:
GITHUB_PULL_REQUEST_SHA: ${{ github.event.pull_request.head.sha }}
SPELLCHECK: true
steps:
- name: Set Environment Variables
run: |
TRIGGERING_SHA=${GITHUB_PULL_REQUEST_SHA:-$GITHUB_SHA}
echo "TRIGGERING_SHA_7=${TRIGGERING_SHA::7}" >> $GITHUB_ENV
echo "TRIGGERING_SHA: $TRIGGERING_SHA"
- name: Checkout Repository
uses: actions/checkout@v2
with:
# fetch entire commit history to support get_rootstock_commit
fetch-depth: 0
- name: Set Environment Variables
run: |
TRIGGERING_SHA=${GITHUB_PULL_REQUEST_SHA:-$GITHUB_SHA}
echo "TRIGGERING_SHA_7=${TRIGGERING_SHA::7}" >> $GITHUB_ENV
echo "TRIGGERING_SHA: $TRIGGERING_SHA"
DEFAULT_BRANCH=$(git remote show origin | grep --perl-regexp --only-matching "(?<=HEAD branch: ).+")
echo "DEFAULT_BRANCH=${DEFAULT_BRANCH}" >> $GITHUB_ENV
echo "DEFAULT_BRANCH_REF=refs/heads/$DEFAULT_BRANCH" >> $GITHUB_ENV
echo "DEFAULT_BRANCH=$DEFAULT_BRANCH"
- name: Cache
uses: actions/cache@v1
with:
path: ci/cache
key: ci-cache-${{ github.ref }}
restore-keys: |
ci-cache-refs/heads/master
ci-cache-${{ env.DEFAULT_BRANCH_REF }}
- name: Install Environment
uses: conda-incubator/setup-miniconda@v2
with:
Expand All @@ -53,7 +59,7 @@ jobs:
name: manuscript-${{ github.run_id }}-${{ env.TRIGGERING_SHA_7 }}
path: output
- name: Deploy Manuscript
if: github.ref == 'refs/heads/master' && github.event_name == 'push' && !github.event.repository.fork
if: github.ref == env.DEFAULT_BRANCH_REF && github.event_name == 'push' && !github.event.repository.fork
env:
MANUBOT_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MANUBOT_SSH_PRIVATE_KEY: ${{ secrets.MANUBOT_SSH_PRIVATE_KEY }}
Expand Down
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ services:
- docker
branches:
only:
- main
- master
env:
- SPELLCHECK=true
Expand All @@ -20,5 +21,6 @@ deploy:
script: bash ci/deploy.sh
skip_cleanup: true
on:
# branch kept as master since travis deployment is legacy.
branch: master
condition: $TRAVIS_EVENT_TYPE = "push" && (-v MANUBOT_SSH_PRIVATE_KEY || "${!encrypted_*}" != "")
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![HTML Manuscript](https://img.shields.io/badge/manuscript-HTML-blue.svg)](https://manubot.github.io/rootstock/)
[![PDF Manuscript](https://img.shields.io/badge/manuscript-PDF-blue.svg)](https://manubot.github.io/rootstock/manuscript.pdf)
[![GitHub Actions Status](https://github.com/manubot/rootstock/workflows/Manubot/badge.svg)](https://github.com/manubot/rootstock/actions)
[![Travis Build Status](https://travis-ci.com/manubot/rootstock.svg?branch=master)](https://travis-ci.com/manubot/rootstock)
[![Travis Build Status](https://travis-ci.com/manubot/rootstock.svg?branch=main)](https://travis-ci.com/manubot/rootstock)
<!-- usage note: delete CI badges above for services not used by your manuscript -->

## Manuscript description
Expand Down Expand Up @@ -79,7 +79,7 @@ Whenever a pull request is opened, CI (continuous integration) will test whether
The build process aims to detect common errors, such as invalid citations.
If your pull request build fails, see the CI logs for the cause of failure and revise your pull request accordingly.

When a commit to the `master` branch occurs (for example, when a pull request is merged), CI builds the manuscript and writes the results to the [`gh-pages`](https://github.com/manubot/rootstock/tree/gh-pages) and [`output`](https://github.com/manubot/rootstock/tree/output) branches.
When a commit to the `main` branch occurs (for example, when a pull request is merged), CI builds the manuscript and writes the results to the [`gh-pages`](https://github.com/manubot/rootstock/tree/gh-pages) and [`output`](https://github.com/manubot/rootstock/tree/output) branches.
The `gh-pages` branch uses [GitHub Pages](https://pages.github.com/) to host the following URLs:

+ **HTML manuscript** at https://manubot.github.io/rootstock/
Expand Down
24 changes: 20 additions & 4 deletions SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* [README updates](#readme-updates)
* [Finalize](#finalize)
- [Merging upstream rootstock changes](#merging-upstream-rootstock-changes)
* [Default branch](#default-branch)

_generated with [markdown-toc](https://ecotrust-canada.github.io/markdown-toc/)_

Expand Down Expand Up @@ -68,7 +69,7 @@ Do not initialize the repository, other than optionally adding a Description.
Next, push your cloned manuscript:

```sh
git push --set-upstream origin master
git push --set-upstream origin main
```

## Continuous integration
Expand Down Expand Up @@ -263,7 +264,7 @@ If the changes look okay, commit and push:
```shell
git add --update
git commit --message "Brand repo to $OWNER/$REPO"
git push origin master
git push origin main
```

You should be good to go now.
Expand All @@ -290,7 +291,7 @@ Second, pull the new commits from rootstock, but do not automerge:
git config remote.rootstock.url || git remote add rootstock https://github.com/manubot/rootstock.git

# pull the new commits from rootstock
git pull --no-ff --no-rebase --no-commit rootstock master
git pull --no-ff --no-rebase --no-commit rootstock main
```

If all goes well, there won't be any conflicts.
Expand All @@ -302,7 +303,7 @@ You may notice changes that affect how items in `content` are processed.
If so, you should edit and stage `content` files as needed.
When there are no longer any unstaged changes, then do `git commit`.

If updating `master` via a pull request, proceed to push the commit to GitHub and open a pull request.
If updating your default branch (i.e. `main` or `master`) via a pull request, proceed to push the commit to GitHub and open a pull request.
Once the pull request is ready to merge, use GitHub's "Create a merge commit" option rather than "Squash and merge" or "Rebase and merge" to preserve the rootstock commit hashes.

The environment for local builds does not automatically update when [`build/environment.yml`](build/environment.yml) changes.
Expand All @@ -312,3 +313,18 @@ To update your local conda `manubot` environment with new changes, run:
# update a local conda environment
conda env update --file build/environment.yml
```

## Default branch

On 2020-10-01, GitHub [changed](https://github.blog/changelog/2020-10-01-the-default-branch-for-newly-created-repositories-is-now-main/) the default branch name for new repositories from `master` to `main`.
More information on GitHub's migration is available at [github/renaming](https://github.com/github/renaming).

On 2020-12-10, Manubot [updated](https://github.com/manubot/rootstock/pull/399) the Rootstock default branch to `main`.
For existing manuscripts, the default branch will remain `master`,
unless manually switched to `main`.
Rootstock has been configured to run continuous integration on both `main` and `master`,
so existing manuscripts can, but are not required, to switch their default branch to `main`.

Upgrading to the latest Rootstock will change several READMEs links to `main`.
For manuscripts that do not plan to switch their default branch,
do not include these changes in the upgrade merge commit.
2 changes: 1 addition & 1 deletion USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ For basic formatting, check out the [CommonMark Help](https://commonmark.org/hel
In addition, Manubot supports an extended version of markdown, tailored for scholarly writing, which includes [Pandoc's Markdown](https://pandoc.org/MANUAL.html#pandocs-markdown) and the extensions discussed below.

The `content/02.delete-me.md` file in the Rootstock repository shows many of the elements and formatting options supported by Manubot.
See the [raw markdown](https://gitlab.com/manubot/rootstock/blob/master/content/02.delete-me.md#L) in this file and compare it to the [rendered manuscript](https://manubot.github.io/rootstock/).
See the [raw markdown](https://gitlab.com/manubot/rootstock/blob/main/content/02.delete-me.md#L) in this file and compare it to the [rendered manuscript](https://manubot.github.io/rootstock/).

Within a paragraph in markdown, single newlines are interpreted as whitespace (same as a space).
A paragraph's source does not need to contain newlines.
Expand Down
2 changes: 1 addition & 1 deletion build/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ dependencies:
- yamllint=1.25.0
- pip:
- errorhandler==2.0.1
- git+https://github.com/manubot/manubot@7c03b4a7d42506b3241e58cd5643a028443b9b9d
- git+https://github.com/manubot/manubot@55c5e1e526261ebadd2aefed2c2757792d8d2ebf
- isbnlib==3.10.3
- opentimestamps-client==0.7.0
- opentimestamps==0.4.1
Expand Down
2 changes: 1 addition & 1 deletion ci/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Continuous integration tools

This directory contains tools and files for continuous integration (CI).
Specifically, [`deploy.sh`](deploy.sh) runs on successful `master` branch builds that are not pull requests.
Specifically, [`deploy.sh`](deploy.sh) runs on successful `main` branch builds that are not pull requests.
The contents of `../webpage` are committed to the `gh-pages` branch.
The contents of `../output` are committed to the `output` branch.

Expand Down
3 changes: 2 additions & 1 deletion ci/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ REPO_SLUG=${TRAVIS_REPO_SLUG:-$GITHUB_REPOSITORY}
COMMIT=${TRAVIS_COMMIT:-$GITHUB_SHA}
CI_BUILD_WEB_URL=${CI_BUILD_WEB_URL:-$TRAVIS_BUILD_WEB_URL}
CI_JOB_WEB_URL=${CI_JOB_WEB_URL:-$TRAVIS_JOB_WEB_URL}
BRANCH=${TRAVIS_BRANCH:-master}
BRANCH=${TRAVIS_BRANCH:-$DEFAULT_BRANCH}
BRANCH=${BRANCH:-main}

# Add commit hash to the README
OWNER_NAME="$(dirname "$REPO_SLUG")"
Expand Down
2 changes: 1 addition & 1 deletion content/02.delete-me.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ Loaded from a specific (hashed) version of the image on GitHub.
**A vector `.svg` image loaded from GitHub.**
The parameter `sanitize=true` is necessary to properly load SVGs hosted via GitHub URLs.
White background specified to serve as a backdrop for transparent sections of the image.
](https://raw.githubusercontent.com/manubot/resources/master/test/vector.svg?sanitize=true "Vector image"){#fig:vector-image height=2.5in .white}
](https://raw.githubusercontent.com/manubot/resources/main/test/vector.svg?sanitize=true "Vector image"){#fig:vector-image height=2.5in .white}

## Tables

Expand Down
4 changes: 2 additions & 2 deletions output/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Generated citation / reference files

The `output` branch contains files automatically generated by the manuscript build process.
It consists of the contents of the `output` directory of the `master` branch.
These files are not tracked in `master`, but instead written to the `output` branch by continuous integration builds.
It consists of the contents of the `output` directory of the `main` branch.
These files are not tracked in `main`, but instead written to the `output` branch by continuous integration builds.

## Files

Expand Down
2 changes: 1 addition & 1 deletion webpage/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ To redirect to the permalink for the latest manuscript version at anytime, use t

## Files

This directory contains the following files, which are mostly ignored on the `master` branch:
This directory contains the following files, which are mostly ignored on the `main` branch:

+ [`index.html`](index.html) is an HTML manuscript.
+ [`manuscript.pdf`](manuscript.pdf) is a PDF manuscript.
Expand Down

0 comments on commit 690aac1

Please sign in to comment.