|
| 1 | +# This workflow uses actions that are not certified by GitHub. |
| 2 | +# They are provided by a third-party and are governed by |
| 3 | +# separate terms of service, privacy policy, and support |
| 4 | +# documentation. |
| 5 | + |
1 | 6 | # Sample workflow for building and deploying a Jekyll site to GitHub Pages |
2 | 7 | name: Deploy Jekyll site to Pages |
3 | 8 |
|
4 | 9 | on: |
| 10 | + # Runs on pushes targeting the default branch |
5 | 11 | push: |
6 | 12 | branches: ["main"] |
| 13 | + |
| 14 | + # Allows you to run this workflow manually from the Actions tab |
7 | 15 | workflow_dispatch: |
8 | 16 |
|
| 17 | +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
9 | 18 | permissions: |
10 | 19 | contents: read |
11 | 20 | pages: write |
12 | 21 | id-token: write |
13 | 22 |
|
| 23 | +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. |
| 24 | +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. |
14 | 25 | concurrency: |
15 | 26 | group: "pages" |
16 | 27 | cancel-in-progress: false |
17 | 28 |
|
18 | 29 | jobs: |
| 30 | + # Build job |
19 | 31 | build: |
20 | 32 | runs-on: ubuntu-latest |
21 | 33 | steps: |
22 | 34 | - name: Checkout |
23 | 35 | uses: actions/checkout@v4 |
24 | | - |
25 | | - # --- Begin ubuntu-24.04 workaround: preinstall Ruby into toolcache --- |
26 | | - - name: Preinstall Ruby into toolcache (ubuntu-24.04 workaround) |
27 | | - if: startsWith(runner.os, 'Linux') |
28 | | - shell: bash |
29 | | - run: | |
30 | | - set -euxo pipefail |
31 | | - VER=3.1.4 |
32 | | - DEST=/opt/hostedtoolcache/Ruby/$VER/x64 |
33 | | -
|
34 | | - if [ -f "$DEST.complete" ]; then |
35 | | - echo "Ruby $VER already installed in toolcache." |
36 | | - exit 0 |
37 | | - fi |
38 | | -
|
39 | | - sudo apt-get update |
40 | | - sudo apt-get install -y --no-install-recommends \ |
41 | | - build-essential libssl-dev zlib1g-dev libreadline-dev libyaml-dev \ |
42 | | - libgdbm-dev libncurses5-dev libffi-dev libdb-dev uuid-dev ca-certificates git |
43 | | -
|
44 | | - git clone --depth=1 https://github.com/rbenv/ruby-build.git /tmp/ruby-build |
45 | | - sudo mkdir -p "$DEST" |
46 | | - sudo /tmp/ruby-build/bin/ruby-build "$VER" "$DEST" |
47 | | -
|
48 | | - sudo chmod -R a+rX /opt/hostedtoolcache/Ruby |
49 | | - sudo touch "$DEST.complete" |
50 | | -
|
51 | | - "$DEST/bin/ruby" -v |
52 | | - # --- End workaround --- |
53 | | - |
54 | 36 | - name: Setup Ruby |
55 | | - uses: ruby/setup-ruby@8575951200e472d5f2d95c625da0c7bec8217c42 # v1.161.0 |
| 37 | + uses: ruby/setup-ruby@086ffb1a2090c870a3f881cc91ea83aa4243d408 # v1.195.0 |
56 | 38 | with: |
57 | | - ruby-version: '3.1.4' # ensure it matches the preinstalled version |
58 | | - bundler-cache: true |
59 | | - cache-version: 0 |
60 | | - |
| 39 | + ruby-version: '3.1' # Not needed with a .ruby-version file |
| 40 | + bundler-cache: true # runs 'bundle install' and caches installed gems automatically |
| 41 | + cache-version: 0 # Increment this number if you need to re-download cached gems |
61 | 42 | - name: Setup Pages |
62 | 43 | id: pages |
63 | 44 | uses: actions/configure-pages@v5 |
64 | | - |
65 | 45 | - name: Build with Jekyll |
| 46 | + # Outputs to the './_site' directory by default |
66 | 47 | run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}" |
67 | 48 | env: |
68 | 49 | JEKYLL_ENV: production |
69 | | - |
70 | 50 | - name: Upload artifact |
| 51 | + # Automatically uploads an artifact from the './_site' directory by default |
71 | 52 | uses: actions/upload-pages-artifact@v3 |
72 | 53 |
|
| 54 | + # Deployment job |
73 | 55 | deploy: |
74 | 56 | environment: |
75 | 57 | name: github-pages |
|
0 commit comments