-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (49 loc) · 1.41 KB
/
publish.yml
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
47
48
49
50
51
52
53
54
55
56
57
58
name: Publish to GitHub Pages
on:
repository_dispatch:
types:
- contentful-change
push:
branches:
- main
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
publish:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'npm'
- name: Cache Gatsby
uses: actions/cache@v3
id: gatsby
with:
path: |
.cache
public
# we have to not include the string "gatsby" in the cache name.
# otherwise, the cache will be busted on every build.
key: ${{ runner.os }}-build-cache
- name: Install
run: npm ci --ignore-scripts --prefer-offline --no-audit
- name: Build
env:
CONTENTFUL_SPACE_ID: ${{ secrets.CONTENTFUL_SPACE_ID }}
CONTENTFUL_ACCESS_TOKEN: ${{ secrets.CONTENTFUL_ACCESS_TOKEN }}
run: npm run build
- name: Publish
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.ref == 'refs/heads/main' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
# don't keep a history of all the commits to the gh_pages branch
force_orphan: true