-
Notifications
You must be signed in to change notification settings - Fork 0
110 lines (98 loc) · 3.16 KB
/
deploy.yaml
File metadata and controls
110 lines (98 loc) · 3.16 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: Deploy to GitHub Pages
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
# Allow this job to clone the repo and create a page deployment
permissions:
contents: read
pages: write
id-token: write
deployments: write
pull-requests: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout your repository using git
uses: actions/checkout@v6
- name: Install D2 diagramming tool
run: |
curl -fsSL https://d2lang.com/install.sh | sh -s --
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version-file: .tool-versions
- name: Enable corepack
run: corepack enable
- name: Install dependencies
run: pnpm install
- name: Build site
run: pnpm run build
- name: Upload GitHub Pages artifact
uses: actions/upload-pages-artifact@v4
with:
path: dist/
- name: Upload dist artifact
uses: actions/upload-artifact@v7
with:
name: dist
path: dist/
deploy-cloudflare:
needs: build
runs-on: ubuntu-latest
environment:
name: cloudflare
url: ${{ steps.cf-url.outputs.value }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version-file: .tool-versions
- name: Enable corepack
run: corepack enable
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Download dist artifact
uses: actions/download-artifact@v8
with:
name: dist
path: dist/
- name: Deploy to Cloudflare Pages
id: deploy
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
WRANGLER_OUTPUT_FILE_DIRECTORY: .wrangler-output
run: pnpm wrangler pages deploy dist --project-name=chinmina --branch=${{ github.head_ref || github.ref_name }}
- name: Extract deployment URL
id: cf-url
if: always() && steps.deploy.outcome == 'success'
run: |
url=$(cat .wrangler-output/wrangler-output-*.json 2>/dev/null \
| jq -r 'select(.type == "pages-deploy-detailed") | .url // empty' \
| head -1)
echo "value=${url}" >> "$GITHUB_OUTPUT"
echo "### Cloudflare Pages" >> "$GITHUB_STEP_SUMMARY"
echo "**URL:** ${url}" >> "$GITHUB_STEP_SUMMARY"
- name: Post PR comment
if: github.event_name == 'pull_request'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WRANGLER_OUTPUT_FILE_DIRECTORY: .wrangler-output
PR_NUMBER: ${{ github.event.pull_request.number }}
run: .github/scripts/cloudflare-deploy.sh comment
deploy:
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5