diff --git a/.appveyor.yml b/.appveyor.yml index d57e0cb8..69d6e6c6 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -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 diff --git a/.github/workflows/manubot.yaml b/.github/workflows/manubot.yaml index 9a2b89b2..9a7d5766 100644 --- a/.github/workflows/manubot.yaml +++ b/.github/workflows/manubot.yaml @@ -2,9 +2,11 @@ name: Manubot on: push: branches: + - main - master pull_request: branches: + - main - master jobs: manubot: @@ -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: @@ -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 }} diff --git a/.travis.yml b/.travis.yml index a8421383..cf4cbb61 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ services: - docker branches: only: + - main - master env: - SPELLCHECK=true @@ -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_*}" != "") diff --git a/README.md b/README.md index d806e795..51fca30f 100644 --- a/README.md +++ b/README.md @@ -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) ## Manuscript description @@ -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/ diff --git a/SETUP.md b/SETUP.md index 136376c1..fa83e0b2 100644 --- a/SETUP.md +++ b/SETUP.md @@ -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/)_ @@ -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 @@ -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. @@ -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. @@ -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. @@ -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. diff --git a/USAGE.md b/USAGE.md index 43230773..a7e446b9 100644 --- a/USAGE.md +++ b/USAGE.md @@ -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. diff --git a/build/environment.yml b/build/environment.yml index df0319e8..f81dfc80 100644 --- a/build/environment.yml +++ b/build/environment.yml @@ -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 diff --git a/ci/README.md b/ci/README.md index db6ccca3..3e89fc2b 100644 --- a/ci/README.md +++ b/ci/README.md @@ -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. diff --git a/ci/deploy.sh b/ci/deploy.sh index ed3d8a89..3c6d44db 100755 --- a/ci/deploy.sh +++ b/ci/deploy.sh @@ -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")" diff --git a/content/02.delete-me.md b/content/02.delete-me.md index 78d9c7ed..c2b1fd0c 100644 --- a/content/02.delete-me.md +++ b/content/02.delete-me.md @@ -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 diff --git a/output/README.md b/output/README.md index fbdc3a6d..12d8f517 100644 --- a/output/README.md +++ b/output/README.md @@ -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 diff --git a/webpage/README.md b/webpage/README.md index 9e22c56d..739f4977 100644 --- a/webpage/README.md +++ b/webpage/README.md @@ -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.