Skip to content

Commit 7593a4e

Browse files
authored
feat: Migrate Actions
Part of #531
1 parent eb5fea3 commit 7593a4e

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

Diff for: .github/workflows/build-deploy-cloudflare.yml

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Build and Deploy (CloudFlare)
2+
3+
on:
4+
push:
5+
branches: ['main']
6+
workflow_dispatch:
7+
pull_request:
8+
9+
env:
10+
GOOGLE_ANALYTICS_TRACKING_ID: ${{ secrets.GOOGLE_TAGMANAGER_ID_SCDF }}
11+
12+
permissions:
13+
contents: read
14+
pull-requests: write
15+
16+
jobs:
17+
# build and deploy main/PR
18+
build:
19+
name: Build site
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
# agent may give node which doesn't work for us
25+
- uses: actions/setup-node@v3
26+
with:
27+
node-version: 18.2.0
28+
29+
# do site build
30+
- name: Yarn build
31+
env:
32+
NODE_OPTIONS: '--openssl-legacy-provider'
33+
run: |
34+
yarn install
35+
yarn run fix
36+
yarn build
37+
38+
# Publish on CloudFlare
39+
- name: Publish to Cloudflare Pages
40+
id: cloudflare-publish
41+
uses: cloudflare/pages-action@v1
42+
with:
43+
apiToken: ${{ secrets.CF_API_TOKEN }}
44+
accountId: ${{ secrets.CF_ACCOUNT_ID }}
45+
projectName: ${{ secrets.CF_PROJECT_NAME }}
46+
directory: public
47+
48+
# If PR, comment with the preview URL
49+
- uses: mshick/add-pr-comment@v2
50+
with:
51+
message-id: cloudflare-deploy
52+
message: |
53+
🚀 Preview at ${{ steps.cloudflare-publish.outputs.url }}
54+
# Chat Notification
55+
# - name: Google Chat Notification
56+
# uses: Co-qn/google-chat-notification@3691ccf4763537d6e544bc6cdcccc1965799d056
57+
# with:
58+
# name: Build (${{ matrix.runner }})
59+
# url: ${{ secrets.GOOGLE_CHAT_WEBHOOK }}
60+
# status: ${{ job.status }}
61+
# if: always()

0 commit comments

Comments
 (0)