-
Notifications
You must be signed in to change notification settings - Fork 5
53 lines (44 loc) · 1.34 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
name: Publish
on:
push:
branches:
- main
pull_request_target:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
name: Publish to Cloudflare Pages
environment:
name: ${{ github.event_name == 'push' && 'Production' || 'Preview' }}
url: ${{ steps.pages.outputs.url }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
fetch-depth: 0
- name: Set up Ruby 3.0
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0' # Not needed with a .ruby-version file
bundler-cache: true
- name: Build
run: |
JEKYLL_ENV=production bundle exec jekyll build --strict_front_matter
- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@v1
id: pages
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: ${{ vars.CLOUDFLARE_PROJECT_NAME }}
directory: _site
branch: ${{ github.event_name == 'push' && github.ref_name || format('pr/{0}', github.event.pull_request.number) }}