-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (73 loc) · 2.21 KB
/
deploy.yaml
File metadata and controls
78 lines (73 loc) · 2.21 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
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
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
steps:
- name: Download dist artifact
uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- 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=chinmina
- name: Add deployment summary
run: |
echo "### Cloudflare Pages Deployment" >> $GITHUB_STEP_SUMMARY
echo "URL: ${{ steps.deploy.outputs.deployment-url }}" >> $GITHUB_STEP_SUMMARY
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "Preview: ${{ steps.deploy.outputs.deployment-url }}" >> $GITHUB_STEP_SUMMARY
fi
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