-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (73 loc) · 2.28 KB
/
Copy pathdeploy.yml
File metadata and controls
77 lines (73 loc) · 2.28 KB
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
name: Deploy to Cloudflare Pages
on:
push:
branches: [main]
paths:
- '.github/workflows/deploy.yml'
- 'components.json'
- 'drizzle.config.ts'
- 'index.html'
- 'package.json'
- 'playwright.config.ts'
- 'pnpm-lock.yaml'
- 'public/**'
- 'src/**'
- 'tsconfig.app.json'
- 'tsconfig.json'
- 'tsconfig.node.json'
- 'vite.config.ts'
- 'wrangler.toml'
pull_request:
branches: [main]
paths:
- '.github/workflows/deploy.yml'
- 'components.json'
- 'drizzle.config.ts'
- 'index.html'
- 'package.json'
- 'playwright.config.ts'
- 'pnpm-lock.yaml'
- 'public/**'
- 'src/**'
- 'tsconfig.app.json'
- 'tsconfig.json'
- 'tsconfig.node.json'
- 'vite.config.ts'
- 'wrangler.toml'
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v6
- uses: pnpm/action-setup@v6
- uses: actions/setup-node@v6
with:
node-version: '22.19'
cache: pnpm
- run: pnpm install --frozen-lockfile --ignore-scripts
- run: pnpm build
- name: Deploy to Cloudflare Pages
id: deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy dist/ --project-name=today-little-log --branch=${{ github.head_ref || github.ref_name }}
- name: Smoke production
if: github.event_name == 'push'
run: curl --fail --silent --show-error --location --output /dev/null --retry 3 --retry-delay 5 https://today-little-log.pages.dev
- name: Comment preview URL on PR
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
const url = '${{ steps.deploy.outputs.deployment-url }}' || 'https://${{ github.head_ref }}.today-little-log.pages.dev';
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `🚀 **Preview deployed:** ${url}`
})