-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (47 loc) · 1.5 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
name: Deploy to Cloudflare Pages
on:
push:
branches:
- main
- preview/**
jobs:
publish:
runs-on: ubuntu-latest
environment: github-pages
permissions:
contents: read
deployments: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Ruby
uses: ruby/setup-ruby@8575951200e472d5f2d95c625da0c7bec8217c42 # v1.161.0
with:
ruby-version: "3.3" # Not needed with a .ruby-version file
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
cache-version: 0 # Increment this number if you need to re-download cached gems
# Only used for pagefind
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Build Jekyll Site
env:
JEKYLL_ENV: production
run: |
if [[ "${{ github.ref }}" == refs/heads/main ]]; then
bundle exec jekyll build
else
bundle exec jekyll build --future
fi
- name: Run pagefind command
# Run after Jekyll build to avoid _site getting overwritten
run: npx -y pagefind
- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@1
with:
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
projectName: flatline
directory: ./_site
gitHubToken: ${{ secrets.GITHUB_TOKEN }}