-
Notifications
You must be signed in to change notification settings - Fork 5.1k
50 lines (48 loc) · 1.67 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
on: [push, workflow_dispatch]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
publish:
runs-on: ubuntu-22.04
permissions:
contents: read
name: Publish to Cloudflare Pages
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22.x
cache: npm
- run: npm ci
- uses: actions/cache/restore@v4
with:
path: |
node_modules/.astro/_astro
node_modules/.astro/assets
key: static
- run: npx astro build
env:
NODE_OPTIONS: --max-old-space-size=4096
- run: npx wrangler pages deploy --project-name cloudflare-docs dist
name: Deploy to Cloudflare Pages
env:
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
- run: npm run build:worker && npx wrangler deploy -c ./wrangler-workers.toml
if: github.ref == 'refs/heads/production'
name: Deploy to Cloudflare Workers [production]
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
- run: npm run build:worker && npx wrangler versions upload -c ./wrangler-workers.toml
if: github.ref != 'refs/heads/production'
name: Deploy to Cloudflare Workers [preview]
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
- uses: actions/cache/save@v4
if: always()
with:
path: |
node_modules/.astro/_astro
node_modules/.astro/assets
key: static