Update Jekyll workflow for Ruby preinstallation #9
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
| # Sample workflow for building and deploying a Jekyll site to GitHub Pages | |
| name: Deploy Jekyll site to Pages | |
| on: | |
| push: | |
| branches: ["main"] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| # --- Begin ubuntu-24.04 workaround: preinstall Ruby into toolcache --- | |
| - name: Preinstall Ruby into toolcache (ubuntu-24.04 workaround) | |
| if: startsWith(runner.os, 'Linux') | |
| shell: bash | |
| run: | | |
| set -euxo pipefail | |
| VER=3.1.4 | |
| DEST=/opt/hostedtoolcache/Ruby/$VER/x64 | |
| if [ -f "$DEST.complete" ]; then | |
| echo "Ruby $VER already installed in toolcache." | |
| exit 0 | |
| fi | |
| sudo apt-get update | |
| sudo apt-get install -y --no-install-recommends \ | |
| build-essential libssl-dev zlib1g-dev libreadline-dev libyaml-dev \ | |
| libgdbm-dev libncurses5-dev libffi-dev libdb-dev uuid-dev ca-certificates git | |
| git clone --depth=1 https://github.com/rbenv/ruby-build.git /tmp/ruby-build | |
| sudo mkdir -p "$DEST" | |
| sudo /tmp/ruby-build/bin/ruby-build "$VER" "$DEST" | |
| sudo chmod -R a+rX /opt/hostedtoolcache/Ruby | |
| sudo touch "$DEST.complete" | |
| "$DEST/bin/ruby" -v | |
| # --- End workaround --- | |
| - name: Setup Ruby | |
| uses: ruby/setup-ruby@8575951200e472d5f2d95c625da0c7bec8217c42 # v1.161.0 | |
| with: | |
| ruby-version: '3.1.4' # ensure it matches the preinstalled version | |
| bundler-cache: true | |
| cache-version: 0 | |
| - name: Setup Pages | |
| id: pages | |
| uses: actions/configure-pages@v5 | |
| - 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@v3 | |
| 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 |