Deploy site #186
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
| # Build and deploy Jekyll site to GitHub Pages | |
| # adapted from https://github.com/actions/starter-workflows/blob/main/pages/jekyll.yml | |
| name: Deploy site | |
| on: | |
| # Runs on pushes targeting the default branch | |
| push: | |
| branches: ["main"] | |
| schedule: | |
| - cron: "36 2 * * *" | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
| # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| # Build job | |
| build: | |
| # run cron jobs only on main repo (not forks), but run other events regardless of fork | |
| if: (github.event_name == 'schedule' && github.repository == 'ResearchObject/ro-crate') || (github.event_name != 'schedule') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Ruby | |
| # https://github.com/ruby/setup-ruby/releases/tag/v1.207.0 | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: "3.3" # Not needed with a .ruby-version file | |
| - name: Setup Pages | |
| id: pages | |
| uses: actions/configure-pages@v5 | |
| - name: Install dependencies | |
| working-directory: ./docs | |
| run: | | |
| sudo apt-get install -y build-essential zlib1g-dev | |
| gem install bundler | |
| bundle config path vendor/bundle | |
| bundle install | |
| - name: Build with Jekyll | |
| # Outputs to the './_site' directory within the working directory | |
| working-directory: ./docs | |
| run: bundle exec jekyll build | |
| env: | |
| JEKYLL_ENV: production | |
| PAGES_REPO_NWO: ${{ github.repository }} | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: ./docs/_site | |
| # Deployment job | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |