|
| 1 | +# Copyright 2026 Google LLC |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# https://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | +name: Deployment to GitHub Pages |
| 15 | + |
| 16 | +on: |
| 17 | + workflow_dispatch: |
| 18 | + push: |
| 19 | + branches: |
| 20 | + - main |
| 21 | + paths: |
| 22 | + - 'site/**' |
| 23 | + - 'docs/**' |
| 24 | + - '.github/workflows/deploy-github-pages.yml' |
| 25 | + pull_request: |
| 26 | + paths: |
| 27 | + - 'site/**' |
| 28 | + - 'docs/**' |
| 29 | + - '.github/workflows/deploy-github-pages.yml' |
| 30 | + |
| 31 | +permissions: |
| 32 | + contents: write |
| 33 | + |
| 34 | +env: |
| 35 | + REPO_NAME: ${{ github.event.repository.name }} |
| 36 | + REPO_OWNER: ${{ github.repository_owner }} |
| 37 | + |
| 38 | +jobs: |
| 39 | + deploy: |
| 40 | + runs-on: ubuntu-latest |
| 41 | + concurrency: |
| 42 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 43 | + steps: |
| 44 | + - uses: actions/checkout@v6 |
| 45 | + with: |
| 46 | + fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod |
| 47 | + submodules: recursive # Fetch any git submodules if configured |
| 48 | + |
| 49 | + - name: Setup Hugo |
| 50 | + uses: peaceiris/actions-hugo@v3 |
| 51 | + with: |
| 52 | + hugo-version: '0.136.5' # Matching local Hugo version |
| 53 | + extended: true |
| 54 | + |
| 55 | + - uses: actions/setup-node@v6 |
| 56 | + with: |
| 57 | + node-version: '20' |
| 58 | + check-latest: true |
| 59 | + |
| 60 | + - name: Install PostCSS dependencies |
| 61 | + run: | |
| 62 | + npm init --yes |
| 63 | + npm install --save-dev autoprefixer postcss-cli postcss |
| 64 | + working-directory: ./site |
| 65 | + |
| 66 | + - name: Build Hugo Site |
| 67 | + run: hugo --baseURL https://sam-mesh.dev --minify |
| 68 | + working-directory: ./site |
| 69 | + |
| 70 | + - name: Deploy to GitHub Pages |
| 71 | + uses: peaceiris/actions-gh-pages@v4 |
| 72 | + if: ${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }} |
| 73 | + with: |
| 74 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 75 | + publish_dir: ./site/public |
| 76 | + cname: sam-mesh.dev |
0 commit comments