-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (49 loc) · 1.86 KB
/
cloudflare-pages.yaml
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
---
name: Cloudflare Pages
on:
push:
workflow_dispatch:
discussion_comment:
types: [created, deleted]
jobs:
cloudflare-pages:
name: Cloudflare Pages
runs-on: ubuntu-24.04-arm
permissions:
contents: read
deployments: write
steps:
- uses: actions/checkout@v4
- name: Load secrets from 1Password
id: op-credentials
uses: 1password/load-secrets-action@v2
with:
export-env: false
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
GH_API: 'op://prod/github-pat-sebboio/credential'
CLOUDFLARE_API_TOKEN: 'op://prod/cloudflare-sebboio-api-token/credential'
CLOUDFLARE_ACCOUNT_ID: 'op://prod/cloudflare-sebboio-api-token/account_id'
CLOUDFLARE_PROJECT_NAME: 'op://prod/cloudflare-sebboio-api-token/project_name'
- name: Set commit in environment
run: echo "COMMIT_ID=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- uses: oven-sh/setup-bun@v2
with:
bun-version-file: '.bun-version'
no-cache: true
- run: bun install --frozen-lockfile
- run: bun --bun run lint
- run: bun --bun run stylelint
- run: bun --bun run format:check
- run: bun --bun run build
env:
GITHUB_USER: ${{ github.repository_owner }}
GITHUB_REPO: ${{ github.event.repository.name }}
GH_API: ${{ steps.op-credentials.outputs.GH_API }}
- name: Publish to Cloudflare Pages
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ steps.op-credentials.outputs.CLOUDFLARE_API_TOKEN }}
accountId: ${{ steps.op-credentials.outputs.CLOUDFLARE_ACCOUNT_ID }}
command: 'pages deploy dist --project-name=${{ steps.op-credentials.outputs.CLOUDFLARE_PROJECT_NAME }}'
gitHubToken: ${{ secrets.GITHUB_TOKEN }}