|
1 | | -name: Build and Deploy to Github Pages |
| 1 | +name: Build and Deploy to GitHub Pages |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | | - branches: |
6 | | - - master # Here source code branch is `master`, it could be other branch |
| 5 | + branches: [ master ] |
| 6 | + |
| 7 | +permissions: |
| 8 | + contents: write |
| 9 | + pages: write |
| 10 | + id-token: write |
7 | 11 |
|
8 | 12 | jobs: |
9 | 13 | build_and_deploy: |
10 | 14 | runs-on: ubuntu-latest |
11 | | - steps: |
12 | | - - uses: actions/checkout@v4 |
13 | 15 |
|
14 | | - # Use GitHub Actions' cache to cache dependencies on servers |
15 | | - - uses: actions/cache@v4 |
16 | | - with: |
17 | | - path: | |
18 | | - .asdf/** |
19 | | - vendor/bundle |
20 | | - key: ${{ runner.os }}-cache-${{ hashFiles('**/cache.key') }} |
21 | | - restore-keys: | |
22 | | - ${{ runner.os }}-cache- |
| 16 | + steps: |
| 17 | + - name: Checkout |
| 18 | + uses: actions/checkout@v4 |
23 | 19 |
|
| 20 | + # Python only if you need to run the glossary script |
24 | 21 | - name: Set up Python |
25 | | - uses: actions/setup-python@v2 |
| 22 | + uses: actions/setup-python@v5 |
26 | 23 | with: |
27 | | - python-version: '3.8' |
| 24 | + python-version: '3.12' |
28 | 25 |
|
29 | 26 | - name: Generate Glossary |
30 | | - run: python scripts/generate_glossary.py |
| 27 | + run: | |
| 28 | + python -m pip install --upgrade pip |
| 29 | + # pip install -r scripts/requirements.txt # if you have one |
| 30 | + python scripts/generate_glossary.py |
31 | 31 |
|
32 | | - # Use GitHub Deploy Action to build and deploy to Github |
33 | | - # For latest version: `jeffreytse/jekyll-deploy-action@master` |
34 | | - - uses: jeffreytse/jekyll-deploy-action@v0.6.0 |
| 32 | + # Use GitHub's official Pages build/deploy (fast, maintained) |
| 33 | + - name: Setup Ruby |
| 34 | + uses: ruby/setup-ruby@v1 |
35 | 35 | with: |
36 | | - provider: 'github' # Default is github |
37 | | - token: ${{ secrets.GITHUB_TOKEN }} # It's your Personal Access Token(PAT) |
38 | | - ssh_private_key: '' # It's your SSH private key (SSH approach) |
39 | | - repository: '' # Default is current repository |
40 | | - branch: 'gh-pages' # Default is gh-pages for github provider |
41 | | - jekyll_src: './' # Default is root directory |
42 | | - jekyll_cfg: '_config.yml' # Default is _config.yml |
43 | | - jekyll_baseurl: '' # Default is according to _config.yml |
44 | | - ruby_ver: '' # Default is 3.2.0 version |
45 | | - bundler_ver: '' # Default is compatible bundler version (~>2.5.0) |
46 | | - cname: '' # Default is to not use a cname |
47 | | - actor: '' # Default is the GITHUB_ACTOR |
48 | | - pre_build_commands: '' # Installing additional dependencies (Arch Linux) |
| 36 | + ruby-version: '3.2' |
| 37 | + bundler-cache: true |
| 38 | + |
| 39 | + - name: Build site with Jekyll |
| 40 | + run: | |
| 41 | + bundle install |
| 42 | + bundle exec jekyll build --trace --destination _site |
| 43 | +
|
| 44 | + - name: Upload artifact |
| 45 | + uses: actions/upload-pages-artifact@v3 |
| 46 | + with: |
| 47 | + path: _site |
| 48 | + |
| 49 | + - name: Deploy to GitHub Pages |
| 50 | + uses: actions/deploy-pages@v4 |
0 commit comments