-
Notifications
You must be signed in to change notification settings - Fork 7
65 lines (57 loc) · 1.89 KB
/
deploy.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
name: Deploy
on:
push:
permissions:
contents: read
jobs:
publish:
runs-on: ubuntu-24.04
if: github.repository_owner == 'harryzcy'
permissions:
contents: read
deployments: write
name: Publish to Cloudflare Pages
steps:
- name: Harden Runner
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
with:
disable-sudo: true
disable-telemetry: true
egress-policy: block
allowed-endpoints: >
api.cloudflare.com:443
api.github.com:443
github.com:443
objects.githubusercontent.com:443
registry.npmjs.org:443
sparrow.cloudflare.com:443
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
with:
node-version: 20
check-latest: true
- name: Extract branch name
shell: bash
run: |
if [[ "${GITHUB_REF}" =~ ^refs/tags/ ]]; then
echo "branch=main" >> "$GITHUB_OUTPUT"
else
echo "branch=${GITHUB_REF#refs/heads/}" >> "$GITHUB_OUTPUT"
fi
id: extract_branch
- name: Build
run: |
make build-cloudflare
- name: Publish to Cloudflare Pages
uses: cloudflare/wrangler-action@7a5f8bbdfeedcde38e6777a50fe685f89259d4ca # v3.13.1
if: ${{ github.actor != 'dependabot[bot]' }}
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy --project-name mailbox-browser --branch ${{ steps.extract_branch.outputs.branch }} dist
workingDirectory: cloudflare
wranglerVersion: "3"