-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (40 loc) · 1.28 KB
/
build.yaml
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
46
name: Build for Cloudflare
on:
pull_request:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: "0.110.0"
- name: build
run: make CF_PAGES_URL="https://karlhaworth.com" publish-cloudflare
- name: Publish to Preview Env
uses: cloudflare/pages-action@1
if: github.event_name == 'pull_request' && github.event.pull_request.merged == false
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: "karlhaworth-com-hugo"
directory: "public"
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
branch: ${GITHUB_REF#refs/heads/}
- name: Publish to Prod
uses: cloudflare/pages-action@1
if: github.event_name != 'pull_request'
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: "karlhaworth-com-hugo"
directory: "public"
gitHubToken: ${{ secrets.GITHUB_TOKEN }}