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/ci/deploy.sh b/ci/deploy.sh index ed3d8a89..30a4f77e 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")"