-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (69 loc) · 2.42 KB
/
wc-deploy-cloudflare-pages.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: "Deploy Cloudflare Pages"
on:
workflow_call:
inputs:
project-name:
required: true
type: string
branch:
required: true
type: string
gh-app-id:
required: true
type: string
pr-comment-enabled:
required: true
type: boolean
backend-url:
required: true
type: string
secrets:
gh-app-private-key:
required: true
cloudflare-account-id:
required: true
cloudflare-api-token:
required: true
permissions:
contents: read
deployments: write
pull-requests: write
jobs:
deploy-cloudflare-pages:
runs-on: ubuntu-24.04
steps:
# https://github.com/marketplace/actions/checkout
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
# https://github.com/marketplace/actions/mise-action
- name: mise action
uses: jdx/mise-action@a4cfebde9ceb9b49b54db1d148fa86a52e1b7fab # v2.1.4
- name: Install deps
run: bun install --frozen-lockfile
- name: Generate env
run: bun plop env -- --backendUrl "${{ inputs.backend-url }}"
- name: Build
run: bun run build
# https://github.com/marketplace/actions/create-github-app-token
- name: Create GitHub App Token
uses: actions/create-github-app-token@5d869da34e18e7287c1daad50e0b8ea0f506ce69 # v1.11.0
id: app-token
with:
app-id: ${{ inputs.gh-app-id }}
private-key: ${{ secrets.gh-app-private-key }}
# https://github.com/marketplace/actions/cloudflare-pages-github-action
- name: Publish to Cloudflare Pages
uses: cloudflare/wrangler-action@b2a0191ce60d21388e1a8dcc968b4e9966f938e1 # v3.11.0
id: cloudflare-pages
with:
apiToken: ${{ secrets.cloudflare-api-token }}
accountId: ${{ secrets.cloudflare-account-id }}
command: pages deploy ./dist --project-name=${{ inputs.project-name }} --branch=${{ inputs.branch }}
# https://github.com/marketplace/actions/lighthouse-check
- name: Lighthouse
uses: foo-software/lighthouse-check-action@a80267da2e0244b8a2e457a8575fc47590615852 # v12.0.1
with:
gitHubAccessToken: ${{ steps.app-token.outputs.token }}
locale: ja
prCommentEnabled: ${{ inputs.pr-comment-enabled }}
urls: ${{ steps.cloudflare-pages.outputs.deployment-url }}