Repository navigation
Update published preprints and suggest paper links in the weekly job #531
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Workflow derived from https://github.com/r-lib/actions/tree/master/examples | |
| # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [main, master] | |
| pull_request: | |
| branches: [main, master] | |
| # closed removes the PR's preview | |
| types: [opened, reopened, synchronize, closed] | |
| schedule: | |
| - cron: '0 5 1 * *' | |
| name: build-and-deploy | |
| # One deployment at a time. The weekly metrics job starts a build of main, | |
| # which can overlap with a change to main, so without this the run that | |
| # started first can publish its older tree over the newer one. In-progress | |
| # runs are left to finish, so a deployment is never half-applied. Each PR has its own | |
| # group, so a new push to a PR replaces its preview build rather than queueing | |
| # behind the site. | |
| concurrency: | |
| group: ${{ github.event_name == 'pull_request' && format('preview-{0}', github.event.number) || 'pages' }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| # The site is served from the gh-pages branch. The main site sits at its root | |
| # and each open PR from this repository gets a preview under pr-preview/pr-N/, | |
| # removed again when the PR is merged or closed. PRs from forks and from | |
| # Dependabot only build: their token cannot push. | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| build: | |
| if: github.event.action != 'closed' | |
| runs-on: ubuntu-latest | |
| env: | |
| GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
| LANG: "en_US.UTF-8" | |
| LC_ALL: "en_US.UTF-8" | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: quarto-dev/quarto-actions/setup@v2 | |
| - uses: r-lib/actions/setup-r@v2 | |
| with: | |
| install-r: true | |
| use-public-rspm: true | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install libcurl4-openssl-dev | |
| - uses: r-lib/actions/setup-renv@v2 | |
| - name: Render site | |
| run: quarto render | |
| - run: cp -r _redirects/. _site | |
| # Pages serves the custom domain from this file when deploying from a | |
| # branch; previews stay out of search results | |
| - name: Add CNAME and keep previews out of search results | |
| run: | | |
| echo "epiforecasts.io" > _site/CNAME | |
| printf 'User-agent: *\nDisallow: /pr-preview/\n' >> _site/robots.txt | |
| - name: Deploy site | |
| if: github.event_name != 'pull_request' | |
| uses: JamesIves/github-pages-deploy-action@v4 | |
| with: | |
| folder: _site | |
| branch: gh-pages | |
| # keep the open PRs' previews when the site is replaced | |
| clean-exclude: pr-preview/ | |
| - name: Deploy preview | |
| if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.user.login != 'dependabot[bot]' | |
| uses: rossjrw/pr-preview-action@v1 | |
| with: | |
| source-dir: _site | |
| preview-branch: gh-pages | |
| umbrella-dir: pr-preview | |
| pages-base-url: epiforecasts.io | |
| # this job is skipped on close, so it only ever deploys | |
| action: deploy | |
| qr-code: false | |
| remove-preview: | |
| if: github.event.action == 'closed' && github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.user.login != 'dependabot[bot]' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Remove preview | |
| uses: rossjrw/pr-preview-action@v1 | |
| with: | |
| preview-branch: gh-pages | |
| umbrella-dir: pr-preview | |
| action: remove |