Build and deploy Jekyll site to GitHub Pages #785
This file contains 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
name: Build and deploy Jekyll site to GitHub Pages | |
on: | |
push: | |
branch: | |
- main | |
schedule: | |
- cron: "0 0 * * *" | |
workflow_dispatch: | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- run: npm install | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
cache-version: 0 # Increment this number if you need to re-download cached gems | |
- name: Setup Pages | |
id: pages | |
uses: actions/configure-pages@v2 | |
- name: Build TinaCMS | |
env: | |
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | |
TINA_CLIENT_ID: ${{ secrets.TINA_CLIENT_ID }} | |
TINA_TOKEN: ${{ secrets.TINA_TOKEN }} | |
if: github.ref == 'refs/heads/main' | |
run: npx tinacms build | |
- name: Generate the coworkers pages | |
env: | |
COWORKERS_URL: ${{ secrets.COWORKERS_URL }} | |
COWORKERS_CODE: ${{ secrets.COWORKERS_CODE }} | |
COWORKERS_USER: ${{ secrets.COWORKERS_USER }} | |
COWORKERS_PASSWORD: ${{ secrets.COWORKERS_PASSWORD }} | |
run: bundle exec ruby sync.rb | |
- name: Build with Jekyll | |
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}" | |
env: | |
JEKYLL_ENV: production | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 |