This is a basic yaml pipeline used in GitHub Actions in order to build this Hugo site and deploys it. After every commit to the main
branch, this process converts markdown files to HTML using the Hugo build actions then deploys the updated site to an App Engine on Google Cloud Provider.
For GCP authentication we followed this walkthrough to setup the workload identity provider. Then we simply place the following yml file into our dotfiles at .github\workflows\google.yml
, replacing the authentication variables.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
| name: Build and Deploy to GCP
on:
push:
branches: [ "main" ]
jobs:
run-app-engine:
name: Run App Engine
runs-on: ubuntu-latest
permissions:
contents: 'read'
id-token: 'write'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive #Ensure we download templates
fetch-depth: 0 #Pull entire file history
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
- name: Build
run: |
hugo --minify --gc
- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v1'
with:
workload_identity_provider: '{workload_identity_provider}'
service_account: '{service_account}'
project_id: '{project_id}'
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v1'
- id: 'deploy'
name: 'Deploy to App Engine'
uses: 'google-github-actions/deploy-appengine@v1'
with:
project_id: '{project_id}'
|