1name: Jekyll Site CI/CD
2
3on:
4 # Test on pull requests
5 pull_request:
6 paths:
7 - 'docs/**'
8 - '*.cue'
9 - '.github/workflows/jekyll-site.yml'
10
11 # Deploy on pushes to main
12 push:
13 branches:
14 - main
15 paths:
16 - 'docs/**'
17 - '*.cue'
18 - '.github/workflows/jekyll-site.yml'
19
20 # Allow manual workflow dispatch
21 workflow_dispatch:
22
23# Sets permissions of the GITHUB_TOKEN to minimum required
24permissions:
25 contents: read
26 pages: write
27 id-token: write
28
29# Allow only one concurrent deployment
30concurrency:
31 group: ${{ github.event_name == 'push' && 'pages' || (github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || format('manual-{0}', github.run_id)) }}
32 cancel-in-progress: false
33
34jobs:
35 # Build and test job
36 build:
37 runs-on: ubuntu-latest
38 steps:
39 - name: Checkout
40 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
41 with:
42 persist-credentials: false
43
44 - name: Setup Pages
45 if: github.event_name == 'push' && github.ref == 'refs/heads/main'
46 id: pages
47 uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0
48
49 - name: Setup Ruby
50 uses: ruby/setup-ruby@v1
51 with:
52 ruby-version: '3.2'
53 bundler-cache: true
54 working-directory: ./docs
55
56 - name: Setup Go
57 uses: actions/setup-go@v6
58 with:
59 go-version: '1.24'
60
61 - name: Generate documentation
62 run: make gendocs
63
64 - name: Build with Jekyll
65 uses: actions/jekyll-build-pages@44a6e6beabd48582f863aeeb6cb2151cc1716697 # v1.0.13
66 with:
67 source: ./docs
68 destination: ./docs/_site
69
70 - name: Test HTML
71 run: make test-links
72
73 - name: Upload artifact for GitHub Pages
74 if: github.event_name == 'push' && github.ref == 'refs/heads/main'
75 uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4.0.0
76 with:
77 path: docs/_site
78
79 # Deployment job (only runs on push to main)
80 deploy:
81 if: github.event_name == 'push' && github.ref == 'refs/heads/main'
82 environment:
83 name: github-pages
84 url: ${{ steps.deployment.outputs.page_url }}
85 runs-on: ubuntu-latest
86 needs: build
87 steps:
88 - name: Deploy to GitHub Pages
89 id: deployment
90 uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5