-
-
Notifications
You must be signed in to change notification settings - Fork 1
48 lines (46 loc) · 1.37 KB
/
pull_request.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
name: Code quality and deploy
on:
push:
branches:
- main
pull_request:
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
statuses: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 'latest'
- name: Install dependencies
run: bun install
- name: Build project
run: bun run build
- name: biome check
run: bun run check:ci
- name: Deploy to Cloudflare Pages
id: cloudflare_pages_deploy
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
projectName: "yossydev-blog"
accountId: ${{ secrets.ACCOUNT_ID }}
directory: './dist'
- name: Add publish URL as commit status
uses: actions/github-script@v7
with:
script: |
const sha = context.payload.pull_request?.head.sha ?? context.sha;
await github.rest.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
context: 'Cloudflare Pages',
description: 'Cloudflare Pages deployment',
state: 'success',
sha,
target_url: "${{ steps.cloudflare_pages_deploy.outputs.url }}",
});