diff --git a/.github/actions/jekyll-build/action.yml b/.github/actions/jekyll-build/action.yml new file mode 100644 index 0000000..9242747 --- /dev/null +++ b/.github/actions/jekyll-build/action.yml @@ -0,0 +1,21 @@ +name: Jekyll Build +description: Installs Ruby gems and builds Jekyll site +runs: + using: composite + steps: + - name: Cache Gem Dependencies + uses: actions/cache@v4 + with: + path: vendor/bundle + key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock', '.ruby-version') }} + + - name: Install Ruby Gems + shell: bash + run: | + gem install bundler + bundle config set path 'vendor/bundle' + bundle install + + - name: Jekyll Build + shell: bash + run: bundle exec jekyll build diff --git a/.github/workflows/github-pages.yml b/.github/workflows/github-pages.yml index dc5cea8..a794b1c 100644 --- a/.github/workflows/github-pages.yml +++ b/.github/workflows/github-pages.yml @@ -16,18 +16,8 @@ jobs: container: ruby:3.2.2-bookworm steps: - uses: actions/checkout@v2 - - uses: actions/cache@v1 - with: - path: vendor/bundle - key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} - - - name: Install Ruby dependencies. - run: | - gem install bundler - bundle install --path vendor/bundle - - name: Build static site with Jekyll. - run: bundle exec jekyll build + - uses: ./.github/actions/jekyll-build - name: Deploy static site to gh-pages branch. uses: peaceiris/actions-gh-pages@v3 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..8177268 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,19 @@ +# GitHub Action for Jekyll +# +# Runs jekyll build on pull requests to verify that they build. + +name: Test Build + +on: + pull_request: + branches: + - master + +jobs: + test: + runs-on: ubuntu-latest + container: ruby:3.2.2-bookworm + steps: + - uses: actions/checkout@v2 + + - uses: ./.github/actions/jekyll-build