Jekyll Contentful Build and Deploy #4
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 | |
run-name: Jekyll Contentful Build and Deploy | |
on: | |
workflow_call: | |
secrets: | |
ACTIONS_DEPLOY_KEY: | |
description: GitHub Deploy Key | |
OSHWA_CONTENTFUL_SPACE_ID: | |
description: 'Contentful Space ID passed from the build-on-publish.yml workflow' | |
required: true | |
OSHWA_CONTENTFUL_DELIVERY_TOKEN: | |
description: 'Contentful Access Token passed from the build-on-publish.yml workflow' | |
required: true | |
push: | |
branches: [ main ] | |
env: | |
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }} | |
OSHWA_CONTENTFUL_SPACE_ID: ${{ secrets.OSHWA_CONTENTFUL_SPACE_ID }} | |
OSHWA_CONTENTFUL_DELIVERY_TOKEN: ${{ secrets.OSHWA_CONTENTFUL_DELIVERY_TOKEN }} | |
jobs: | |
pull-build-deploy: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
ruby-version: [3.1.2] | |
node-version: [16.14] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Ruby ${{ matrix.ruby-version }} | |
uses: ruby/setup-ruby@8575951200e472d5f2d95c625da0c7bec8217c42 | |
with: | |
ruby-version: ${{ matrix.ruby-version }} | |
- name: Install bundler | |
run: gem install bundler | |
- name: Install dependencies | |
run: bundle install | |
- name: Pull data from Contentful | |
run: bundle exec jekyll contentful | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install npm dependencies | |
run: npm install | |
- name: Build | |
run: npm run build | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} | |
publish_dir: ./_site |